3

In an Azure hosted MVC app I have mail settings as follows

<system.net>
<mailSettings>
  <smtp deliveryMethod="Network" from="support@smeedi.com">
    <network defaultCredentials="false" host="smtp.gmail.com" userName="username@gmail.com" enableSsl="true" port="587" password="password" />
  </smtp>
</mailSettings>

When I create a new SMTP client like this:

SmtpClient client = new SmtpClient();

All the details are empty and when the client tries to send the email I get an SMTP host not specified exception. This only started happening when upgrading to MVC4 and Azure 2.0 (from Mvc 3 and Azure 1.7) Why is it not using the mail settings from config?

4

1 に答える 1