In my MVC4 application, I'm trying to get mail sent using Web.config for configuration settings. I have papercut running as a mock SMTP server. When I try to use smtpClient and set host="localhost" in my code (that is, not through Web.config) everything works just fine.
My Web.config
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="[email protected]">
<network
host="localhost"
userName=""
password=""
defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
My code
SmtpClient client = new SmtpClient();
client.Send(myEmailObject);
The error
The SMTP host was not specified