public void SendSmtpEmail(EmailServiceModels model) { var appSetting = new AppSettings(); MailMessage mail = new MailMessage(); mail.Body = model.Body; mail.IsBodyHtml = model.IsBodyHtml; mail.Priority = MailPriority.High; mail.Subject = model.Subject; foreach (var item in model.Attachments) { mail.Attachments.Add(new Attachment(item)); } foreach (var to in model.To) { mail.To.Add(to); } new SmtpClient().SendAsync(mail, new Guid().ToString()); }
private EmailServiceModels BuildEmailMessage(string email) { var appSettings = new AppSettings(); var mail = new EmailServiceModels(); mail.IsBodyHtml = true; mail.Subject = "Cocaine-books Password Recovery"; var data = "{0}".Fmt(email);// , DateTime.Now.AddHours(2).ToString("hh-mm-ss")); string encrypted = data.Encrypt("hash"); mail.Body = @"Hello, <br/><br/> Please use the link below to reset your password:<br/> {0}<br/><br/> Thank you,<br/> Cocaine Books".Fmt(appSettings.Get("Site.ResetUrl", "") + "?" + encrypted); mail.To.Add(email); return mail; }