Jay
Jay

Reputation: 1356

Sending external email as distribution group in ASP .Net

first off, not sure if this question should have been on serverfault vs. stackoverflow, sorry if it is in the wrong spot.

I am having a problem sending email to outside emails from my ASP .Net application where the "from" address is a distribution group. I will try to lay everything out:

Email Server: Exchange 2010

I have a domain user "websmtp" that was created in order to perform authenticated sending.

I am trying to send the mail from [email protected]. This is a distribution (may actually be a security group?). I want to do this so the replys to my emails will go to the group. Nobody will be monitoring the websmtp user's mailbox.

Here is the web.config smtp section

<system.net>
    <mailSettings>
        <smtp from="[email protected]">
            <network host="XXX.XXX.XXX.XXX" userName="websmtp" password="thepassword" />
        </smtp>
    </mailSettings>
</system.net>

Sample email code:

MailMessage mm = new MailMessage();
mm.To.Add("[email protected]");
mm.Subject = "this is a test";
mm.Body = "this is a test";
mm.IsBodyHtml = false;

SmtpClient s = new SmtpClient();
s.Send(mm);

This code fails with a message from Exchange "Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender". The "websmtp" user was granted SendOnBehalfOf permissions to the "webmaster" group using the Set-DistributionGroup command.

I CAN send on behalf of the webmaster user when logged in as the websmtp user either through Windows or through my companies OWA webmail to both internal and external users.

At this point I am really just looking for suggestions for what to ask our Exchange admin to try or if there is anything else I can try in my web.config. I can't really code around this because a lot of the emails that I am generating come directly from the ASP .Net membership wizards.

Upvotes: 1

Views: 1108

Answers (1)

Jason Meckley
Jason Meckley

Reputation: 7591

sounds like an authentication issue to me. it looks like you are setting the username and password, but maybe they are either incorrect or the credentials are not be passed correctly.

Upvotes: 1

Related Questions