protected virtual MailMessage GetMailMessage(RazorMailMessage razorMailMessage) { var mailMessage = razorMailMessage.GetMailMessage(Parser); // Set the sender and, if required, the from address mailMessage.Sender = Sender; // Sender (e.g. the CEO's Assistant) mailMessage.From = mailMessage.From ?? Sender; // From (e.g. the CEO) return mailMessage; }
protected override MailMessage GetMailMessage(RazorMailMessage razorMailMessage) { var mailMessage = base.GetMailMessage(razorMailMessage); // If in testing then alter message if (TestAddress != null) { mailMessage.To.Clear(); // TODO: Put the original recipient lists into the test message (inline or attachment?) mailMessage.CC.Clear(); mailMessage.Bcc.Clear(); mailMessage.To.Add(TestAddress); } return mailMessage; }
/// <summary> /// Sends the specified RazorMailMessage to an SMTP server for delivery /// </summary> /// <param name="message"></param> public void Send(RazorMailMessage razorMailMessage) { using (var mailMessage = GetMailMessage(razorMailMessage)) Client.Send(mailMessage); }