Пример #1
0
 /// <inheritdoc />
 public override void SetSender(EmailAddress sender)
 {
     // Sanity.
     if (null == sender)
     {
         throw new ArgumentNullException(nameof(sender));
     }
     this.mailMessage.Sender = EmailMessage.ConvertToMailAddress(sender);
 }
Пример #2
0
 /// <inheritdoc />
 public override void SetFrom(EmailAddress from)
 {
     // Sanity.
     if (null == from)
     {
         throw new ArgumentNullException(nameof(from));
     }
     this.mailMessage.From = EmailMessage.ConvertToMailAddress(from);
 }
Пример #3
0
 /// <inheritdoc />
 public override void SetReplyToList(List <EmailAddress> replytolist)
 {
     // Sanity.
     if (null == replytolist)
     {
         throw new ArgumentNullException(nameof(replytolist));
     }
     foreach (EmailAddress emailAddress in replytolist)
     {
         this.mailMessage.ReplyToList.Add(EmailMessage.ConvertToMailAddress(emailAddress));
     }
 }
Пример #4
0
        /// <inheritdoc />
        public override void AddRecipient(AddressType addressType, EmailAddress emailAddress)
        {
            switch (addressType)
            {
            case AddressType.To:
                this.mailMessage.To.Add(EmailMessage.ConvertToMailAddress(emailAddress));
                break;

            case AddressType.CarbonCopy:
                this.mailMessage.CC.Add(EmailMessage.ConvertToMailAddress(emailAddress));
                break;

            case AddressType.BlindCarbonCopy:
                this.mailMessage.Bcc.Add(EmailMessage.ConvertToMailAddress(emailAddress));
                break;

            default:
                throw new ArgumentException($"Unhandled address type {addressType}.", nameof(addressType));
            }
        }