Thursday 31 January 2013

MVC - Sending Email using Exchange Server

Add the following in the Web.config file:

<system.net>
  <mailSettings>

    <smtp from="info@mycompany.com">
<network enableSsl="false" port="25" host="mail.mycompany.com" defaultCredentials="true" />
    </smtp>


  </mailSettings>


</system.net>

Without setting "defaultCredentials" to true, you can only send email in the same domain.  When you send email outside the domain, you will receive "Mailbox unavailable. The server response was: 5.7.1 Unable to relay for whoever@notmycompany.com" error.

No comments:

Post a Comment