private MailMessage CreateMailmsg(EmailTemplate emailTemplate,Data args) { var valueaParser = new EmailValueParser(); var from = emailTemplate.From ; var to = emailTemplate.To; var subject = emailTemplate.Subject; var message = new MailMessage (); message.To.Add(new MailAddress(to)); message.Subject = emailTemplate.Subject; message.Body = valueaParser.CreateMessage("SendMain.txt", args); return message; }
public void SendEmailMessage(Data args) { var valueaParser = new EmailValueParser(); var email = new EmailTemplate([email protected]","Booking","Confirmation"); var message = CreateMailmsg(email, args); using (var smtp = new SmtpClient()) { smtp.UseDefaultCredentials = true; smtp.Host = ""; smtp.Port = 25; try { smtp.Send(message); } catch (SmtpException ex) { } } }