public void SendEmailMethod(string ToEmail, string EmailSubject, string EmailBody) { EncryptData _EncryptData = new EncryptData(); SmartLeavesDataContext db = new SmartLeavesDataContext(); var _SiteSettings = db.SiteSettings.SingleOrDefault(); string _Password = _EncryptData.Decrypt(_SiteSettings.EmailPassword); string _Email = _SiteSettings.EMail; string smtpAddress = "smtp.mail.yahoo.com"; int smtpPort = 587; string EmailFrom = _Email; string Password = _Password; MailMessage Mail = new MailMessage(); Mail.From = new MailAddress(EmailFrom); Mail.To.Add(ToEmail); Mail.Subject = EmailSubject; Mail.Body = EmailBody; Mail.IsBodyHtml = true; SmtpClient smtpObject = new SmtpClient(smtpAddress, smtpPort); smtpObject.Credentials = new NetworkCredential(EmailFrom, Password); smtpObject.EnableSsl = true; smtpObject.Send(Mail); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)