[英]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. 我正在使用System.Net.Mail.SmtpClient将电子邮件发送到通讯组列表这是我使用的方法。 xyz@domain.com is the distribution list.
xyz@domain.com是通讯组列表。
var strMailServer = ConfigurationManager.AppSettings["MailServer"];
var fromAddress = new MailAddress("abc@domain.com");
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("xyz@domain.com");
message.Subject = _context.Fields["Subject"].Value;
message.IsBodyHtml = true;
message.Body = bodyMsg;
smtpClient.Send(message);
The mail is not delivered to xyz@domain.com distribution list. 邮件未传递到xyz@domain.com分发列表。 Am I missing something?
我想念什么吗?
创建通讯组列表时,取消选中“要求所有发件人都经过身份验证”
If you are using a username and password other than your windows credentials, you need to set UseDefaultCredentials
to false before providing the new credentials: 如果您使用的用户名和密码不是Windows凭据,则需要在提供新凭据之前将
UseDefaultCredentials
设置为false:
var smtpClient = new SmtpClient(strMailServer)
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential("", ""),
Port = 25,
EnableSsl = true
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.