示例#1
0
 public bool SendEmail(EmailAddresses addresses, string subject, string body)
 {
     return(SendEmail(new EmailMessage(addresses)
     {
         Subject = subject, Body = body
     }));
 }
示例#2
0
 private void AddReplyToIfDefined(EmailAddresses emailAddresses, MailMessage mailMessage)
 {
     if (!string.IsNullOrEmpty(emailAddresses.ReplyTo))
     {
         mailMessage.ReplyTo = new MailAddress(emailAddresses.ReplyTo);
     }
 }
示例#3
0
 /// <summary>
 /// Create a message with reasonable defaults
 /// </summary>
 /// <remarks>
 /// By default the message will be plain text
 /// </remarks>
 public EmailMessage(EmailAddresses emailAddresses)
 {
     _emailAddresses = emailAddresses;
     Subject         = string.Empty;
     Body            = string.Empty;
     AttachmentPath  = string.Empty;
     IsHtmlBody      = false;
 }
示例#4
0
 private void AddCcs(EmailAddresses emailAddresses, MailMessage mailMessage)
 {
     foreach (string cc in emailAddresses.CcList)
     {
         if (cc.Trim().Length > 0)
         {
             mailMessage.CC.Add(cc);
         }
     }
 }
示例#5
0
 private void AddBccs(EmailAddresses emailAddresses, MailMessage mailMessage)
 {
     foreach (string bcc in emailAddresses.BccList)
     {
         if (bcc.Trim().Length > 0)
         {
             mailMessage.Bcc.Add(bcc);
         }
     }
 }
示例#6
0
        private void AddTos(EmailAddresses emailAddresses, MailMessage mailMessage)
        {
            if (emailAddresses.RecipientList.Count < 2)
            {
                return;
            }

            for (int i = 1; i < emailAddresses.RecipientList.Count; i++)
            {
                mailMessage.To.Add(emailAddresses.RecipientList.ElementAt(i));
            }
        }
示例#7
0
 public EmailMessage(string from, string to, string cc)
     : this(new EmailAddresses(from, to) { CcList = EmailAddresses.SplitEmailAddresses(cc) })
 {
 }