This is the code that worked without any issues on our project:
internal override void Send(string[] recipients, string subject, string message, string[] attachments)
{
#pragma warning disable 612,618
var mail = new MailMessage();
#pragma warning restore 612,618
mail.Fields[SmtpServer] = _smtpHost;
mail.Fields[SmtpServerPort] = _smtpPort;
mail.Fields[SendUsing] = 2;
mail.Fields[SmtpUseSsl] = true;
mail.Fields[SmtpAuthenticate] = 1;
mail.Fields[SendUsername] = _username;
mail.Fields[SendPassword] = _password;
mail.BodyEncoding = Encoding.UTF8;
mail.From = string.Format("{0} <{1}>", _displayName, _username);
mail.To = string.Join(";", recipients);
mail.Subject = subject;
mail.Body = message;
if (attachments != null)
{
foreach (var attachment in attachments)
{
#pragma warning disable 612,618
mail.Attachments.Add(new MailAttachment(Path.GetFullPath(attachment), MailEncoding.Base64));
#pragma warning restore 612,618
}
}
#pragma warning disable 612,618
SmtpMail.Send(mail);
#pragma warning restore 612,618
}
}
///////
You can try to use it