12. October 2007 11:19
That is amazing how easy it is to fix any problem as soon as it gets to the status of the ex-problem. After I found the way to make my email work on GoDaddy with their Form Mailer, I took another look at SMTP and sure enough all peaces readily fall into place. Here is step-by-step instruction on how to setup and use SMTP with GoDaddy – the way God intended.
1. Get GoDaddy’s email account. I believe it comes with any domain registration or hosting package for free. Do not use external POP account (Google, Yahoo, Hotmail etc.). They all require SSL and custom port and you’ll get nothing but trouble. So sign up for internal GoDaddy mail account, your SMTP server will be smtp.secureserver.net (or whatever they assign you). The reason SMTP did not work for me is exactly that – it was blocked by firewall on my hosting server. So, let’s say you have domain “smith.com” with GoDaddy. When you create email account you will set user name and password, let’s say it is “john” and “password”. And your server is “smtp.secureserver.net”. This is how you create your client then:
2. In your code, create message - the usual way:
MailMessage message = new MailMessage();
message.From = newMailAddress("firstname.lastname@example.org");
message.Subject = "test";
message.Body = "This is test";
3. Set up client and send message:
SmtpClient smtp = new SmtpClient("smtp.secureserver.net");
smtp.Credentials = new System.Net.NetworkCredential("john","password");
smtp.Port = 25;
smtp.EnableSsl = false;
Pretty easy - ones you understand why your message is not getting to smtp.gmail.com with SSL on through the port 465 (583, 995…). Because they all closed!