In my MVC4 application, I am trying to get mail sent using Web.config for configuration settings. My papercut works as an SMTP mock server. When I try to use smtpClient and set host = "localhost" in my code (that is, not through Web.config), everything works fine.
My web.config
<system.net> <mailSettings> <smtp deliveryMethod="Network" from=" someone@somewhere.net "> <network host="localhost" userName="" password="" defaultCredentials="true" /> </smtp> </mailSettings> </system.net>
My code
SmtpClient client = new SmtpClient(); client.Send(myEmailObject);
Error
SMTP host not specified
source share