public void Send(EmailTemplate template, IEmailFormatter formatter, ParameterCollection parameterHash) { EmailTemplate formattedTemplate = formatter.Format(template, parameterHash); logger.DebugFormat(@" Send email: {0} To: {1}, From: {2}, {3}", formattedTemplate.Subject, formattedTemplate.To, formattedTemplate.From, formattedTemplate.Body); }
public void Send(EmailTemplate template, IEmailFormatter formatter, ParameterCollection parameterHash) { try { EmailTemplate template2 = formatter.Format(template, parameterHash); MailMessage message = this.CreateMailMessage(template2); this.smtpClient.Send(message); } catch (Exception exception) { //Logger.Error("Error on sending mail: " + exception, new object[0]); } }
public virtual void Send(EmailTemplate template, IEmailFormatter formatter, ParameterCollection parameterHash) { EmailTemplate formattedEmailTemplate = formatter.Format(template, parameterHash); MailMessage mailMessage = new MailMessage(formattedEmailTemplate.From, formattedEmailTemplate.To, formattedEmailTemplate.Subject, formattedEmailTemplate.Body); mailMessage.IsBodyHtml = !String.IsNullOrEmpty(formattedEmailTemplate.BodyContentType) && formattedEmailTemplate.BodyContentType.Equals("text/html"); try { smtpClient.Send(mailMessage); } catch (Exception ex) { logger.Error("Error on sending mail: " + ex); throw new EmailSenderException("System cannot send email to " + formattedEmailTemplate.To); } }