private MailMessage PrepareMessage( string recipient, string subject, string body, IEnumerable <string> bccRecipients, AttachmentCollection attachments) { var mailTo = new MailAddress(recipient); var mailFrom = new MailAddress(this.senderEmail, this.senderDisplayName); var message = new MailMessage(mailFrom, mailTo) { Body = body, BodyEncoding = Encoding.UTF8, IsBodyHtml = true, Subject = subject, SubjectEncoding = Encoding.UTF8, }; if (bccRecipients != null) { foreach (var bccRecipient in bccRecipients) { message.Bcc.Add(bccRecipient); } } if (attachments != null && attachments.Any()) { message.Attachments.AddRange(attachments); } return(message); }