private static void StaticReadMailByNo(int i) { if (i != 0) { if (SpeechModule.GetStatus()) { SpeechSynthesizer synth = new SpeechSynthesizer(); synth.SetOutputToDefaultAudioDevice(); MailServer mailserver = new MailServer(); List <Mail> listmails = mailserver.ReceivedMailsList(LoginCredentials.LoggedEmailId); if (listmails != null) { if (listmails.Count >= i) { synth.SetOutputToDefaultAudioDevice(); Mail FilterMail = listmails.ElementAt(i - 1); synth.Speak("Message " + i.ToString()); synth.Speak("From " + FilterMail.FromEmailId); synth.Speak("Subject" + FilterMail.Subject); synth.Speak("Message " + FilterMail.Message); } else { synth.Speak("You have only " + listmails.Count + " mail"); } } } } }
public ActionResult UpdateMailServer(MailServer ms) { var email = db.MailServers.FirstOrDefault(x => x.ID == 1); if (email != null) { if (ms.Email == email.Email) { if (ms.Password == email.Password) { return(RedirectToAction("UPDATE_MAILSERVER")); } else { ModelState.AddModelError("", "Mật khẩu không đúng!"); return(View()); } } else { ModelState.AddModelError("", "Email hiện tại không đúng!"); return(View()); } } else { return(View("NotFound", "Home")); } }
private void Form1_Load(object sender, EventArgs e) { string curpath = Directory.GetCurrentDirectory(); string mailbox = String.Format("{0}\\inbox", curpath); // If the folder is not existed, create it. if (!Directory.Exists(mailbox)) { Directory.CreateDirectory(mailbox); } MailServer oServer = new MailServer("pop.gmail.com", "*****@*****.**", "jarvis99", ServerProtocol.Pop3); MailClient oClient = new MailClient("TryIt"); // If your POP3 server requires SSL connection, // Please add the following codes: oServer.SSLConnection = true; oServer.Port = 995; MessageBox.Show("Connection opened"); try { oClient.Connect(oServer); MailInfo[] infos = oClient.GetMailInfos(); MessageBox.Show("Mail information received"); MessageBox.Show(infos.ToString()); for (int i = 0; i < infos.Length; i++) { MailInfo info = infos[i]; //Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}", // info.Index, info.Size, info.UIDL); // Receive email from POP3 server Mail oMail = oClient.GetMail(info); MessageBox.Show("From: " + oMail.From.ToString()); MessageBox.Show("Subject: \r\n" + oMail.Subject); MessageBox.Show("inside1"); // Generate an email file name based on date time. System.DateTime d = System.DateTime.Now; System.Globalization.CultureInfo cur = new System.Globalization.CultureInfo("en-US"); string sdate = d.ToString("yyyyMMddHHmmss", cur); string fileName = String.Format("{0}\\{1}{2}{3}.eml", mailbox, sdate, d.Millisecond.ToString("d3"), i); MessageBox.Show("inside4"); // Save email to local disk oMail.SaveAs(fileName, true); // Mark email as deleted from POP3 server. oClient.Delete(info); } // Quit and pure emails marked as deleted from POP3 server. oClient.Quit(); } catch (Exception ep) { MessageBox.Show("error" + ep.Message); } }
private void ReadMail() { if (SpeechModule.GetStatus()) { synth.SetOutputToDefaultAudioDevice(); MailServer mailserver = new MailServer(); List <Mail> listmails = mailserver.ReceivedMailsList(LoginCredentials.LoggedEmailId); if (listmails != null) { bool UnreadCount = listmails.Any(X => X.IsRead == 0); if (UnreadCount) { synth.SetOutputToDefaultAudioDevice(); synth.Speak("You have some unread mails"); synth.Speak("I will read one by one for you"); IEnumerable <Mail> Unreadmails = listmails.Where(X => X.IsRead == 0); int k = 0; foreach (var Msg in Unreadmails) { k++; synth.Speak("Message " + k.ToString()); synth.Speak("From " + Msg.FromEmailId); synth.Speak("Subject" + Msg.Subject); synth.Speak("Message " + Msg.Message); MailServer.MarkMsgAsRead(Msg.MsgId); LoadInboxMails(); } } else { synth.Speak("You dont have any unread mails"); } } } }
public void Connect(string server, string User, string pass, int port, bool useSSl) { oServer = new MailServer(server, User, pass, useSSl, ServerAuthType.AuthLogin, mprotocol == MailProtocol.pop3?ServerProtocol.Pop3 : ServerProtocol.Imap4); oClient = new MailClient("TryIt"); oServer.Port = port; oClient.Connect(oServer); }
//remove the local uidl which is not existed on the server. private void _SyncUIDL(MailServer oServer, MailInfo[] infos) { string s = String.Format("{0}#{1} ", oServer.Server, oServer.User); bool bcontinue = false; int n = 0; do { bcontinue = false; int count = m_arUidl.Count; for (int i = n; i < count; i++) { string x = m_arUidl[i] as string; if (String.Compare(s, 0, x, 0, s.Length, true) == 0) { int pos = x.LastIndexOf(' '); if (pos != -1) { string uidl = x.Substring(pos + 1); if (!_FindUIDL(infos, uidl)) { //this uidl doesn't exist on server, //so we should remove it from local uidl list to save the storage. bcontinue = true; n = i; m_arUidl.RemoveAt(i); break; } } } } } while (bcontinue); }
public DnsData GetDnsRecords(int id) { if (!IsAdmin) { throw new SecurityException("Need admin privileges."); } if (id < 0) { throw new ArgumentException(@"Invalid domain id.", "id"); } var domain = MailServer.GetWebDomain(id, MailServerFactory); var dns = domain.GetDns(MailServerFactory); if (dns == null) { return(new DnsData()); } var isVerified = dns.CheckDnsStatus(); if (domain.IsVerified != isVerified) { domain.SetVerified(isVerified); } return(dns.ToDnsData()); }
protected void btnNotifyEContact_Click(object sender, ImageClickEventArgs e) { if (Session["userid"] == null) { Response.Redirect("Login.aspx"); } DBManager dbm = new DBManager(); MySqlParameter[] param = new MySqlParameter[1]; param[0] = new MySqlParameter("@uID", MySqlDbType.Int32); param[0].Value = Convert.ToInt32(Session["userid"].ToString()); DataTable dt = dbm.fetchRows("select eEmailID,fname,lname,phno,address from cmpe285.USER_DETAILS where uID=@uID", param); string email = dt.Rows[0][0].ToString(); string name = dt.Rows[0][1].ToString() + " " + dt.Rows[0][2]; string phno = dt.Rows[0][3].ToString(); string address = dt.Rows[0][4].ToString(); MailServer mail = new MailServer(); mail.sendMail(email, "Help!!", "You are the registered emergency contact for " + name + ". The person is in need of help. Please contact immediately at Ph." + phno + "\nAddress" + address); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.onload=function(){"); sb.Append("alert('"); sb.Append("Emergency contact notified."); sb.Append("')};"); sb.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); }
public bool IsDomainExists(string name) { if (!IsAdmin) { throw new SecurityException("Need admin privileges."); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException(@"Invalid domain name.", "name"); } if (name.Length > 255) { throw new ArgumentException(@"Domain name exceed limitation of 255 characters.", "name"); } if (!Parser.IsDomainValid(name)) { throw new ArgumentException(@"Incorrect domain name.", "name"); } var domainName = name.ToLowerInvariant(); var isExists = MailServer.IsDomainExists(domainName); return(isExists); }
public int RemoveMailGroupAddress(int mailgroup_id, int address_id) { if (!IsAdmin) { throw new SecurityException("Need admin privileges."); } if (address_id < 0) { throw new ArgumentException(@"Invalid address id.", "address_id"); } if (mailgroup_id < 0) { throw new ArgumentException(@"Invalid mailgroup id.", "mailgroup_id"); } var mailgroup = MailServer.GetMailGroup(mailgroup_id, MailServerFactory); if (mailgroup == null) { throw new ArgumentException("Mailgroup not exists"); } mailgroup.RemoveMember(address_id); MailBoxManager.CachedAccounts.ClearAll(); return(address_id); }
public AccountController(SignInManager <ApplicationUser> signInManager, UserManager <ApplicationUser> userManager, IActivityLogRepository repo) { this.signInManager = signInManager; this.userManager = userManager; this.mailServer = new MailServer(); this.repo = repo; }
protected void odsServerConfig_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { MailServer ms = e.InputParameters[0] as MailServer; try { MailServerConfigFacade facade = MailServerConfigFacade.GetInstance(); facade.insertServerConfig(ms); this.IdServer_ViewState = ms.Id; info.AddMessage("Operazione effettuata", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.OK); } catch (ManagedException mEx) { info.AddMessage(mEx.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } catch (Exception ex) { ManagedException mEx = new ManagedException("Errore nell'inserimento del nuovo server", "CM010", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.loggingAppCode = "WEB_MAIL"; err.objectID = this.Context.Session.SessionID; if (MySecurityProvider.CurrentPrincipal != null && MySecurityProvider.CurrentPrincipal.MyIdentity != null) { err.userID = MySecurityProvider.CurrentPrincipal.MyIdentity.UserName; } log.Error(err); info.AddMessage(mEx.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } }
// 添加接收邮箱 public static void Tos(MailServer mailServer, string mateclass, MailMessage msg) { var duty = ""; if (mateclass[0] == '数') { duty = "数字"; } else if (mateclass[0] == '无') { duty = "无线"; } else { duty = "新世界"; } var yf = mailServer.Find2Duty(duty); var iqc = mailServer.Find2Duty("IQC"); foreach (var i in yf) { msg.To.Add(i.MailAddre); } foreach (var i in iqc) { msg.To.Add(i.MailAddre); } }
public int RemoveMailboxAlias(int mailbox_id, int address_id) { if (!IsAdmin) { throw new SecurityException("Need admin privileges."); } if (address_id < 0) { throw new ArgumentException(@"Invalid address id.", "address_id"); } if (mailbox_id < 0) { throw new ArgumentException(@"Invalid mailbox id.", "mailbox_id"); } var mailbox = MailServer.GetMailbox(mailbox_id, MailServerFactory); if (mailbox == null) { throw new ArgumentException("Mailbox not exists"); } mailbox.RemoveAlias(address_id); return(mailbox_id); }
public MailboxData CreateMyMailbox(string name) { if (!SetupInfo.IsVisibleSettings("AdministrationPage") || !SetupInfo.IsVisibleSettings("MailCommonDomain") || CoreContext.Configuration.Standalone) { throw new Exception("Common domain is not available"); } var domain = MailServer.GetWebDomains(MailServerFactory).FirstOrDefault(x => x.Tenant == Defines.SHARED_TENANT_ID); if (domain == null) { throw new SecurityException("Domain not found."); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException(@"Invalid mailbox name.", "name"); } var teamlabAccount = CoreContext.Authentication.GetAccountByID(SecurityContext.CurrentAccount.ID); if (teamlabAccount == null) { throw new InvalidDataException("Unknown user."); } var userInfo = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID); if (userInfo.IsVisitor()) { throw new InvalidDataException("User is visitor."); } if (name.Length > 64) { throw new ArgumentException(@"Local part of mailbox localpart exceed limitation of 64 characters.", "name"); } if (!Parser.IsEmailLocalPartValid(name)) { throw new ArgumentException("Incorrect mailbox name."); } var mailboxName = name.ToLowerInvariant(); var login = string.Format("{0}@{1}", mailboxName, domain.Name); var password = PasswordGenerator.GenerateNewPassword(12); var account = MailServerFactory.CreateMailAccount(teamlabAccount, login); var mailbox = MailServer.CreateMailbox(mailboxName, password, domain, account, MailServerFactory); if (IsSignalRAvailable) { MailBoxManager.UpdateUserActivity(TenantId, UserId); } return(mailbox.ToMailboxData()); }
public void WantedInbox(string emailName) { Show(); Text = emailName; RegistryKey currentLoginKey = emailLoginsKey.OpenSubKey(emailName, true); loginInfo = new LoginInfo() { email = emailName, portSMTP = currentLoginKey.GetValue("portSMTP").ToString(), portIMAP = currentLoginKey.GetValue("portIMAP").ToString(), serverSMTP = currentLoginKey.GetValue("serverSMTP").ToString(), serverIMAP = currentLoginKey.GetValue("serverIMAP").ToString(), contracena = Program.DecryptStringFromBytes((byte[])currentLoginKey.GetValue("contracena", RegistryValueKind.Binary), Encoding.ASCII.GetBytes("1234567890123456"), Encoding.ASCII.GetBytes("1234567890123456")) }; mailServer = new MailServer(loginInfo.serverIMAP, loginInfo.email, loginInfo.contracena, ServerProtocol.Imap4) { SSLConnection = true, Port = Int32.Parse(loginInfo.portIMAP) }; mailClient = new MailClient("TryIt"); try { mailClient.Connect(mailServer); } catch (Exception ex) { Text = "rozłączono"; } getFoldersDisplayed(); }
public MailboxData UpdateMailbox(int mailbox_id, string name) { if (!IsAdmin) { throw new SecurityException("Need admin privileges."); } if (mailbox_id < 0) { throw new ArgumentException(@"Invalid mailbox id.", "mailbox_id"); } if (name.Length > 255) { throw new ArgumentException(@"Sender name exceed limitation of 64 characters.", "name"); } var mailbox = MailServer.GetMailbox(mailbox_id, MailServerFactory); if (mailbox == null) { throw new ArgumentException("Mailbox not exists"); } MailServer.UpdateMailbox(mailbox, name, MailServerFactory); MailBoxManager.CachedAccounts.Clear(mailbox.Account.TeamlabAccount.ID.ToString()); return(mailbox.ToMailboxData()); }
public MailOperationStatus RemoveMailbox(int id) { if (id < 0) { throw new ArgumentException(@"Invalid domain id.", "id"); } var mailbox = MailServer.GetMailbox(id, MailServerFactory); if (mailbox == null) { throw new ItemNotFoundException("Account not found."); } var isSharedDomain = mailbox.Address.Domain.Tenant == Defines.SHARED_TENANT_ID; if (!IsAdmin && !isSharedDomain) { throw new SecurityException("Need admin privileges."); } if (isSharedDomain && !IsAdmin && mailbox.Account.TeamlabAccount.ID != SecurityContext.CurrentAccount.ID) { throw new SecurityException("Removing of a shared mailbox is allowed only for the current account if user is not admin."); } return(RemoveMailbox(mailbox)); }
public int RemoveMailboxAlias(int mailbox_id, int address_id) { if (!IsAdmin) { throw new SecurityException("Need admin privileges."); } if (address_id < 0) { throw new ArgumentException(@"Invalid address id.", "address_id"); } if (mailbox_id < 0) { throw new ArgumentException(@"Invalid mailbox id.", "mailbox_id"); } var mailbox = MailServer.GetMailbox(mailbox_id, MailServerFactory); if (mailbox == null) { throw new ArgumentException("Mailbox not exists"); } mailbox.RemoveAlias(address_id); MailBoxManager.CachedAccounts.Clear(mailbox.Account.TeamlabAccount.ID.ToString()); return(mailbox_id); }
private void BtnUpdateMessages_Click(object sender, RoutedEventArgs e) { listBoxMessages.Items.Clear(); MailServer server = new MailServer( textServer.Text, textEmail.Text, textPassword.Password, EAGetMail.ServerProtocol.Imap4) { SSLConnection = true, Port = 993 }; MailClient client = new MailClient("TryIt"); try { client.Connect(server); var messages = client.GetMailInfos(); foreach (var m in messages) { Mail message = client.GetMail(m); listBoxMessages.Items.Add($"From: {message.From}\n\n\t{message.Subject}\n"); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } }
internal static MailUser MapToMailUser(MAIL_SENDERS dr, MailServer s, List <Folder> l) { MailUser u = null; if (s != null) { u = new MailUser(s); } else { u = new MailUser(); } u.UserId = dr.ID_SENDER; u.IdResponsabile = (decimal)dr.ID_RESPONSABILE; u.Casella = dr.MAIL; u.Dominus = (s == null) ? "" : s.Dominus; u.EmailAddress = dr.MAIL; u.LoginId = dr.USERNAME; u.Password = dr.PASSWORD; u.Folders = l; if (dr.FLG_MANAGED != null) { u.FlgManaged = int.Parse(dr.FLG_MANAGED); u.FlgManagedInsert = (dr.FLG_MANAGED == "0") ? false : true; } else { u.FlgManagedInsert = false; } return(u); }
void OdznaczJeNaSerwerze() { foreach (string emailName in emailLoginsKey.GetSubKeyNames()) { RegistryKey currentLoginKey = emailLoginsKey.OpenSubKey(emailName, true); LoginInfo loginInfo = new LoginInfo() { email = emailName, portSMTP = currentLoginKey.GetValue("portSMTP").ToString(), portIMAP = currentLoginKey.GetValue("portIMAP").ToString(), serverSMTP = currentLoginKey.GetValue("serverSMTP").ToString(), serverIMAP = currentLoginKey.GetValue("serverIMAP").ToString(), contracena = Program.DecryptStringFromBytes((byte[])currentLoginKey.GetValue("contracena", RegistryValueKind.Binary), Encoding.ASCII.GetBytes("1234567890123456"), Encoding.ASCII.GetBytes("1234567890123456")) }; MailServer mailServer = new MailServer(loginInfo.serverIMAP, loginInfo.email, loginInfo.contracena, ServerProtocol.Imap4) { SSLConnection = true, Port = Int32.Parse(loginInfo.portIMAP) }; MailClient mailClient = new MailClient("TryIt"); mailClient.Connect(mailServer); MailInfo[] infos = mailClient.GetMailInfos(); foreach (MailInfo mailInfo in infos) { foreach (UnreadMail unreadMailTemp in unreadMails) { if (unreadMailTemp.shouldMarkAsRead && mailInfo.UIDL == unreadMailTemp.idUIDL && unreadMailTemp.emailLogin == emailName) { mailClient.MarkAsRead(mailInfo, true); } } } } }
public ActiveUp.Net.Mail.DeltaExt.MailUser GetManagedUserByAccount(string userName) { MailUser User = null; using (FAXPECContext dbcontext = new FAXPECContext()) { try { var mailsender = dbcontext.MAIL_SENDERS.Where(x => (x.FLG_MANAGED == "2" || x.FLG_MANAGED == "1") && x.MAIL.ToUpper() == userName.ToUpper()).FirstOrDefault(); int idmailserver = (int)mailsender.ID_MAILSERVER; int idmailuser = (int)mailsender.ID_SENDER; if (idmailserver != 0) { MAILSERVERS m = dbcontext.MAILSERVERS.Where(x => x.ID_SVR == idmailserver).FirstOrDefault(); MailServer s = AutoMapperConfiguration.FromMailServersToModel(m); if (idmailuser != 0) { List <Folder> l = GetMailFolders(idmailuser); User = DaoSQLServerDBHelper.MapToMailUser(mailsender, s, l); } } } catch { User = null; throw; } } return(User); }
private void AddAndCloseButton_Click(object sender, EventArgs e) { try { XMLHelper helper = new XMLHelper(); MailServer NewServer = new MailServer() { ID = helper.LastElementUniqueID(XMLDataStorage.Location + "MailServers.xml", "Server") + 1, Name = NameTextBox.Text, Description = DescriptionTextBox.Text, Host = HostTextBox.Text, Port = Convert.ToInt32(PortTextBox.Text), Username = UsernameTextBox.Text, Password = PasswordTextBox.Text, FromAddress = FromAddressTextBox.Text, IsSecured = IsSecuredCheckbox.Checked }; mailServerManager.Add(NewServer); MessageBox.Show("Mail Server is successfully added"); this.Close(); } catch (Exception ex) { MessageBox.Show("Failed to add new mail server", ex.Message); } }
public ActiveUp.Net.Mail.DeltaExt.MailUser GetById(decimal id) { ActiveUp.Net.Mail.DeltaExt.MailUser user = null; using (FAXPECContext dbcontext = new FAXPECContext()) { var mailsender = dbcontext.MAIL_SENDERS.Where(x => x.ID_SENDER == id).FirstOrDefault(); try { int idmailserver = (int)mailsender.ID_MAILSERVER; MAILSERVERS ms = dbcontext.MAILSERVERS.Where(x => x.ID_SVR == idmailserver).FirstOrDefault(); MailServer s = AutoMapperConfiguration.FromMailServersToModel(ms); int idmailuser = (int)mailsender.ID_SENDER; List <Folder> list = GetMailFolders(idmailuser); user = DaoSQLServerDBHelper.MapToMailUser(mailsender, s, list); } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(ex.Message, "ERR_ACC_006", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.objectID = id.ToString(); log.Error(err); } user = null; } } return(user); }
public ICollection <ActiveUp.Net.Mail.DeltaExt.MailUser> GetAllManaged() { ICollection <MailUser> users = null; using (FAXPECContext dbcontext = new FAXPECContext()) { try { var mailsenders = dbcontext.MAIL_SENDERS.Where(x => x.FLG_MANAGED != null).ToList(); foreach (MAIL_SENDERS sender in mailsenders) { int idMailServer = (int)sender.ID_MAILSERVER; int idUser = (int)sender.ID_SENDER; if (idMailServer != 0) { MAILSERVERS m = dbcontext.MAILSERVERS.Where(x => x.ID_SVR == idMailServer).FirstOrDefault(); MailServer s = AutoMapperConfiguration.FromMailServersToModel(m); if (idUser != 0) { List <Folder> l = GetMailFolders(idUser); users.Add(DaoSQLServerDBHelper.MapToMailUser(sender, s, l)); } } } } catch { users = null; throw; } } return(users); }
public MailServer GetById(decimal id) { MailServer mailserver = null; using (var dbcontext = new FAXPECContext()) { try { var m = dbcontext.MAILSERVERS.Where(x => x.ID_SVR == (double)id).First(); mailserver = AutoMapperConfiguration.FromMailServersToModel(m); } catch (SqlException oex) { //Allineamento log - Ciro if (oex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException(DalExMessages.TITOLO_NON_RECUPERATO + oex.Message, "DAL_TIT_010", string.Empty, string.Empty, oex); ErrorLogInfo er = new ErrorLogInfo(mEx); log.Error(er); throw mEx; } else { throw; } //throw new ManagedException(DalExMessages.TITOLO_NON_RECUPERATO, "DAL_TIT_010", "", "", "", "", "", oex); } } return(mailserver); }
public AddressData AddMailboxAlias(int mailbox_id, string alias_name) { if (string.IsNullOrEmpty(alias_name)) { throw new ArgumentException("Invalid alias name.", "alias_name"); } if (mailbox_id < 0) { throw new ArgumentException("Invalid mailbox id.", "mailbox_id"); } if (alias_name.Length > 64) { throw new ArgumentException("Local part of mailbox alias exceed limitation of 64 characters.", "alias_name"); } if (!Parser.IsEmailLocalPartValid(alias_name)) { throw new ArgumentException("Incorrect mailbox alias."); } var mailbox = MailServer.GetMailbox(mailbox_id, MailServerFactory); var mailbox_alias_name = alias_name.ToLowerInvariant(); var alias = mailbox.AddAlias(mailbox_alias_name, mailbox.Address.Domain, MailServerFactory); return(alias.ToAddressData()); }
public int RemoveMailbox(int id) { if (id < 0) { throw new ArgumentException("Invalid domain id.", "id"); } var mailbox = MailServer.GetMailbox(id, MailServerFactory); var groups = MailServer.GetMailGroups(MailServerFactory); var groups_contains_mailbox = groups.Where(g => g.InAddresses.Contains(mailbox.Address)) .Select(g => g); foreach (var mail_group in groups_contains_mailbox) { if (mail_group.InAddresses.Count == 1) { MailServer.DeleteMailGroup(mail_group.Id, MailServerFactory); } else { mail_group.RemoveMember(mailbox.Address.Id); } } MailServer.DeleteMailbox(mailbox); return(id); }
public void UpdateMail(string name) { var mailServer = new MailServer(); var current = mailServer.GetBy(name); if (current != null) { int Num; bool isNum = int.TryParse(tbxPort.Text, out Num); if (isNum) { current.Name = tbxName.Text; current.Server = tbxServer.Text; current.Username = tbxUsername.Text; current.Password = tbxPassword.Text; current.Port = Num; int result = current.Update(); if (result == 1) { var manager = (frmManager)Application.OpenForms["frmManager"]; manager.SelectTab("tabMails"); Close(); } } } }
public MailServer CreateMailServer() { MailServer oServer = new MailServer("imap.gmail.com", "*****@*****.**", "hulksmash1", ServerProtocol.Imap4); oServer.SSLConnection = true; oServer.Port = 993; return oServer; }
void Mailer(String FromMail, String pwd) { MailServer objMail = new MailServer(); MailData objmaildata = new MailData(); objmaildata.from = "*****@*****.**"; objmaildata.fromName = "KOD ROYAL CARD TEAM"; //objmaildata.to = "*****@*****.**"; objmaildata.to = FromMail.ToString(); objmaildata.toName = "Royal Card Forgot Password: Mail"; objmaildata.subject = "Royal Card Forgot Password Mail"; string BodyMaggage = "<p> Email Id: " + FromMail.ToString() + "</p>" + "<p> New Password: "******"</p>" + "<p>Regards</p><p>KOD ROYAL CARD TEAM</p>" ; objmaildata.bodyMessage = BodyMaggage; objMail.sendMail_Net(objmaildata); }
void HTMLMailer(String FromMail, String pwd, String WebId) { MailServer objMail = new MailServer(); MailData objmaildata = new MailData(); objmaildata.from = "*****@*****.**"; objmaildata.fromName = "KOD ROYAL CARD TEAM"; objmaildata.to = FromMail.ToString(); objmaildata.toName = "Royal Card Forgot Password: Mail"; objmaildata.subject = "Royal Card Forgot Password Mail"; string BodyMaggage = "<div style='height:770px; width:727px; background:url(http://royalty.kingdomofdreams.in/Skins/images/Emailer2.jpg) no-repeat;'>" + "<div style='text-align:center; padding:260px 290px 50px 65px; font-family:Palatino Linotype, Century Gothic, Arial; font-weight:bold; font-size:14px;'>" + "<p>Your holiness " + WebId.ToString() + ",</p>" + "<p>Your Password is : " + pwd.ToString() + "</p>" + "</div></div>" ; objmaildata.bodyMessage = BodyMaggage; objMail.SendMailKOD(objmaildata); }
internal Connection(MailServer objServer) { Server = objServer; }
public SendEmailMission(string mailServerID, string mailRecipient, string proposedEmailSubject, OS _os) { server = (MailServer) Programs.getComputer(_os, mailServerID).getDaemon(typeof (MailServer)); mailSubject = proposedEmailSubject; this.mailRecipient = mailRecipient; }
public SMTPClient(MailServer objServer) { Server = objServer; }
public Pop3Client(MailServer objServer) { Server = objServer; }
public List<PurchaseEmail> CheckEmail() { string curpath = Directory.GetCurrentDirectory(); string mailbox = String.Format("{0}\\inbox", curpath); string htmlMailbox = String.Format("{0}\\htmlInbox", curpath); // If the .eml and .htm folders do not exist, create it. if (!Directory.Exists(mailbox)) { Directory.CreateDirectory(mailbox); } if (!Directory.Exists(htmlMailbox)) { Directory.CreateDirectory(htmlMailbox); } // Gmail IMAP4 server is "imap.gmail.com" MailServer oServer = new MailServer("imap.gmail.com", "*****@*****.**", "**Jessica8", ServerProtocol.Imap4); MailClient oClient = new MailClient("TryIt"); // Set SSL connection, oServer.SSLConnection = true; // Set 993 IMAP4 port oServer.Port = 993; try { oClient.Connect(oServer); MailInfo[] infos = oClient.GetMailInfos(); for (int i = 0; i < infos.Length; i++) { MailInfo info = infos[i]; //Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}", info.Index, info.Size, info.UIDL); // Download email from GMail IMAP4 server Mail oMail = oClient.GetMail(info); if (oMail.From.ToString().Contains("*****@*****.**")) { // Generate an email file name based on date time. System.DateTime d = System.DateTime.Now; var cur = new System.Globalization.CultureInfo("en-US"); string sdate = d.ToString("yyyyMMddHHmmss", cur); string fileName = String.Format("{0}\\{1}{2}{3}.eml", mailbox, sdate, d.Millisecond.ToString("d3"), i); // Save email to local disk oMail.SaveAs(fileName, true); } // Mark email as deleted in GMail account. oClient.Delete(info); } // Quit and purge emails marked as deleted from Gmail IMAP4 server. oClient.Quit(); } catch (Exception ep) { MessageBox.Show(ep.Message); } // Get all *.eml files in specified folder and parse it one by one. string[] files = Directory.GetFiles(mailbox, "*.eml"); var purchaseList = new List<PurchaseEmail>(); for (int i = 0; i < files.Length; i++) { var convertedMessage = ConvertMailToHtml(files[i]); if (System.IO.File.Exists(files[i])) { // Use a try block to catch IOExceptions, to // handle the case of the file already being // opened by another process. try { System.IO.File.Delete(files[i]); } catch (System.IO.IOException e) { MessageBox.Show(e.Message); } } purchaseList.Add(convertedMessage); } return purchaseList; }
public Pop3EventArgs(ActionType intAction, MailServer objServer, string strDescription) { Action = intAction; Server = objServer; Description = strDescription; }