如何从 ac# Web 应用程序向 Active Directory 通讯组发送电子邮件?
我正在尝试向 Active Directory 通讯组发送电子邮件。
我知道您可以使用以下方式发送邮件:
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
//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 组(例如“我的测试组”)时,它会将其踢出,因为它是不是有效的电子邮件地址。
我确信这真的很简单,但我似乎被困住了......
谢谢
I'm trying to send email to Active Directory distribution groups.
I know you can send mail using something like:
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
//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);
But when I try to stick in a (valid) AD group (eg "My Test Group") in the To
field, it kicks it out because it is not a valid email address.
I'm sure this is really straightforward, but I seem to be stuck...
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的通讯组有一个邮件地址,这就是您需要在“收件人”参数中添加的地址。
You distribution group has a mail address, that's what you need to add in the 'to' parameter.