public void SendMessage(string sTo, string sToName, string sSubject, string sBody, string sFilePath) { SmtpClient smtp = new SmtpClient(m_sSmtp); MailAddress maddrFrom = new MailAddress(m_sUserId, m_sUserName); MailAddress maddrTo = new MailAddress(sTo, sToName); MailMessage mmsg = new MailMessage(maddrFrom, maddrTo); string sPassword = CSettings.DecryptedPassword(m_sPassword); mmsg.SubjectEncoding = System.Text.Encoding.UTF8; mmsg.BodyEncoding = System.Text.Encoding.UTF8; mmsg.Subject = sSubject; mmsg.Body = sBody; if (sFilePath != null) { Attachment attachment; attachment = new System.Net.Mail.Attachment(sFilePath); mmsg.Attachments.Add(attachment); } smtp.Port = m_iPort; smtp.EnableSsl = m_bSslTls; smtp.Credentials = new NetworkCredential(m_sUserId, sPassword); smtp.Send(mmsg); mmsg.Dispose(); smtp.Dispose(); }
private void GetMailUseridAndPassword(out string sUserid, out string sPassword) { sUserid = m_settings.Contents.MailUserId; string sEncripted = m_settings.Contents.MailPassword; sPassword = CSettings.DecryptedPassword(sEncripted); }
public CImap(CSettings settings) { m_settings = settings; }