Yes! A solution for this strange error! How many times have you seen this one while trying to send an e-mail?
I had a quite interesting Friday. It was the last day of a class in which I had to replace the trainer. They had some problems with him and I was the choosen one for the replacement. Everything went well so far. After that I went to check the error log of my blog (I use Elmah, by the way) and I found an issue I've never seen before:
System.Net.Mail.SmtpException
Error in processing. The server response was: Greylisted, please try again in 240 seconds
The time may vary. But after google it for a while I found it! My server was implementing Greylisting which, according to Wikipedia, is a method of defending e-mail users against spam. So, the non-recognized e-mails are automatically rejected for a while.
And how to fix that?
All I needed to do was to create a mail account on my server and add it to my web.config in the following way:
<system.net> <mailSettings> <smtp> <network defaultCredentials="false" host="Mail@DomainName.com" port="25" userName="username@DomainName.com" password="ThisIsAPassword"/> </smtp> </mailSettings> </system.net>
Needless to say, you need to put your own host, username and password. :-)
And that's it.
In time: The answer I found here.
<system.net> <mailSettings> <smtp> <network defaultCredentials="false" host="mail.davidsonsousa.net" port="25" userName="contact@davidsonsousa.net" password="D#sousa12"/> </smtp> </mailSettings> </system.net>