public bool SendEmail(EmailAddresses addresses, string subject, string body) { return(SendEmail(new EmailMessage(addresses) { Subject = subject, Body = body })); }
private void AddReplyToIfDefined(EmailAddresses emailAddresses, MailMessage mailMessage) { if (!string.IsNullOrEmpty(emailAddresses.ReplyTo)) { mailMessage.ReplyTo = new MailAddress(emailAddresses.ReplyTo); } }
/// <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; }
private void AddCcs(EmailAddresses emailAddresses, MailMessage mailMessage) { foreach (string cc in emailAddresses.CcList) { if (cc.Trim().Length > 0) { mailMessage.CC.Add(cc); } } }
private void AddBccs(EmailAddresses emailAddresses, MailMessage mailMessage) { foreach (string bcc in emailAddresses.BccList) { if (bcc.Trim().Length > 0) { mailMessage.Bcc.Add(bcc); } } }
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)); } }
public EmailMessage(string from, string to, string cc) : this(new EmailAddresses(from, to) { CcList = EmailAddresses.SplitEmailAddresses(cc) }) { }