I have a site hosted on GoDaddy and have an e-mail account set up with my GoDaddy account that uses smtpout.secureserver.net as its outgoing server. I am trying to send an e-mail from my test server, not the actual GoDaddy production server, using this account. My test server is using IIS 7 and is running my ASP.NET MVC site. I use the code below, but every time it executes I get an SmtpException. The InnerText says that it is unable to connect to the remote server. Any thoughts on what I am doing wrong?
MailMessage mailObj = new MailMessage();
mailObj.From = new MailAddress(this.FromEmail);
mailObj.Subject = subject;
mailObj.Body = message;
mailObj.To.Add(new MailAddress(this.PayerEmail));
mailObj.IsBodyHtml = true;
SmtpClient objSmtp = new SmtpClient();
objSmtp.Host = this.SmtpHost;
objSmtp.Port = System.Int32.Parse(this.SmtpPort);
objSmtp.UseDefaultCredentials = false;
objSmtp.Credentials = new System.Net.NetworkCredential(this.FromEmail, this.FromEmailPassword);
objSmtp.EnableSsl = false;
objSmtp.Send(mailObj);
I am sure that the Credentials are correct. Also, the port I am using is 25. Again, the host is smtpout.secureserver.net. I read the following article but couldn't figure out my mistake: http://rtur.net/blog/post/2007/10/12/SMTP-with-GoDaddy.aspx