如何通过c#Web应用程序向Active Directory通讯组发送电子邮件?
-
08-07-2019 - |
题
我正在尝试向Active Directory通讯组发送电子邮件。
我知道您可以使用以下内容发送邮件:
mail.From = new MailAddress("steveb@microsoft.com");
mail.To.Add("billg@microsoft.com");
//set the content
mail.Subject = "This is an email";
mail.Body = "this is a sample body with html in it.";
mail.IsBodyHtml = true;
//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
// i seem to need this too....
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtp.Send(mail);
但是,当我尝试在To
字段中坚持(有效)AD组(例如<!>“我的测试组<!>”;)时,它会将其解除,因为它不是有效的电子邮件地址。
我确信这真的很简单,但我似乎陷入了困境......
由于
解决方案
您的通讯组有一个邮件地址,这是您需要在'to'参数中添加的内容。
不隶属于 StackOverflow