如何通过c#Web应用程序向Active Directory通讯组发送电子邮件?

时间:2008-11-20 11:18:34

标签: c# active-directory smtp email active-directory-group

我正在尝试向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);

但是,当我尝试在[{1}}字段中坚持(有效)AD组(例如“我的测试组”)时,它会将其踢出,因为它不是有效的电子邮件地址。

我确信这真的很简单,但我似乎陷入了困境......

由于

1 个答案:

答案 0 :(得分:2)

您的通讯组有一个邮件地址,这是您需要在'to'参数中添加的内容。

相关问题