Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SmtpClient class not picking up default parameters from Web.Config file

config file :

<system.net>
<mailSettings>
<smtp from="[email protected]">
<network
host="mail.xxxxxx.com"
port="25"
password="password"
userName="[email protected]"
defaultCredentials="false"
/>
</smtp>
</mailSettings>
</system.net>

I've already tried defaultCredentials="true" but i recieved following message:

System.FormatException: Smtp server returned an invalid response.

how to fix the problem?


2 Answers

Set the deliveryMethod property on the smtp element to 'network'.

like image 193
John Sheehan Avatar answered Nov 21 '25 11:11

John Sheehan


sorry, had the web.config from the Views folder in ASP.NET MVC open, not the one in the application root - DOH!!!!!

Working fine now :))