In .NET, can I send email using the identity of an AD group that I own?
My current code:
using (var smtp = new SmtpClient("smtp.somecompany.com"))
{
smtp.Credentials = CredentialCache.DefaultNetworkCredentials;
var mail = new MailMessage("mygroup@somecompany.com", recipients)
{
...
};
smtp.Send(mail);
}
And I'm getting
System.Net.Mail.SmtpException: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
I know I can send as a different user by using
smtp.Credentials = new NetworkCredential(...)
and pass name/password pair.
However, an AD group does not have a password, and I don't think the group alias even count as a user name.
So is it possible to send email as the group at all?