Represents a razor e-mail message that can be sent using a concrete implementation of the RazorMail.IRazorMailSender interface.
Inheritance: IDisposable
コード例 #1
0
ファイル: RazorMailSender.cs プロジェクト: wduffy/RazorMail
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
ファイル: RazorMailSender.cs プロジェクト: wduffy/RazorMail
 /// <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);
 }