Search code examples
c#listsmtpclient

Sending email to a distribution list using System.Net.Mail.SmtpClient


I'm sending email to a distribution list using System.Net.Mail.SmtpClient Here is the method I use. [email protected] is the distribution list.

var strMailServer = ConfigurationManager.AppSettings["MailServer"];
var fromAddress = new MailAddress("[email protected]");
var bodyMsg = "BodyText;
var message = new MailMessage();
var smtpClient = new SmtpClient(strMailServer)
{
    Credentials = new NetworkCredential("", ""),
    Port = 25,
    EnableSsl = true
};

message.From = fromAddress;
message.To.Add("[email protected]");
message.Subject = _context.Fields["Subject"].Value;
message.IsBodyHtml = true;
message.Body = bodyMsg;
smtpClient.Send(message);

The mail is not delivered to [email protected] distribution list. Am I missing something?


Solution

  • When creating the distribution list, uncheck "Require that all senders are authenticated"