public void Send(string sender, string recipient, string carbonCopy, string blindCarbonCopy, IEnumerable <MailHeader> mailHeaders, string subject, string body) { if (String.IsNullOrEmpty(sender)) { throw new ArgumentException("sender"); } if (String.IsNullOrEmpty(recipient)) { throw new ArgumentException("recipient"); } mail = new MailMessage(sender, recipient); if (!String.IsNullOrEmpty(carbonCopy)) { mail.CC.Add(carbonCopy); } if (!String.IsNullOrEmpty(blindCarbonCopy)) { mail.Bcc.Add(blindCarbonCopy); } mail.SubjectEncoding = Encoding.UTF8; mail.BodyEncoding = Encoding.UTF8; mail.Subject = subject; mail.Body = body; headers = mailHeaders; if (mailHeaders != null) { foreach (var mailHeader in mailHeaders) { try { if ((mailHeader.Name != String.Empty) && (mailHeader.Value != String.Empty)) { mail.Headers.Add(Base64.Encode(mailHeader.Name), Base64.Encode(mailHeader.Value)); } } catch { } } } try { // NTLM (NT LAN Manager) Authentication /SMTP Extension/ throws System.FormatException - Invalid length for a Base-64 char array. if (ForceSmtpAuthentication) { smtpClient.ForceSmtpAuthentication(SmtpAuthentication); } smtpClient.SendAsync(mail, null); } catch (Exception ex) { OnSentChanged(new SentChangedEventArgs(headers, ex, Arguments)); } }