public string SendEmail(EmailTemplateDTO input, IEnumerable<MailAddress> addresses ) { try { var mergedEmailFactory = _container.GetInstance<IMergedEmailFactory>(); MailMessage message = mergedEmailFactory .WithTokenValues(input.TokenValues) .WithSubject(input.Subject) .WithHtmlBody(input.Body) .Create(); message.From = input.From; message.To.AddRange(addresses); var smtpClient = new SmtpClient("mail.methodfitness.com", 25); smtpClient.Send(message); } catch(Exception ex) { return ex.Message; } return string.Empty; }
public string SendEmail(EmailTemplateDTO input) { return SendEmail(input, input.Addresses ?? new[] { input.To }); }