I have created an asp.net site that has a contact form that sends an email to an account. It works locally on my machine, but when I deploy it to Godaddy, it does not work and throws an exception:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 198.37.144.225:587
Godaddy says it must be on my end.
I have read just about every article that google offers and have contacted Godaddy several times for support with no avail.
Does anyone have any advice, links, or examples they currently have working on an ASP.Net 4.5 C# site hosted on godaddy?
Here is what I have:
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtpout.secureserver.net";
smtp.Port = 465;
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("name@mydomain.com", "password");
MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("name@mydomain.com");
mailMsg.To.Add(new MailAddress("diffname@yahoo.com"));
mailMsg.ReplyTo = new MailAddress("name@mydomain.com");
mailMsg.Subject = "New contact message from site";
mailMsg.Body = string.Format("Name: {0}<br /><br /> Phone number: {1}<br /><br /> Email: {2}<br /><br />" +
"Subject:{3}", name, phone ?? "None provided", from, subject);
mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
smtp.Send(mailMsg);
I have also tried:
SmtpClient smtp = new SmtpClient();
smtp.Host = "relay-hosting.secureserver.net";
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("name@mydomain.com");
mailMsg.To.Add(new MailAddress("name@yahoo.com"));
mailMsg.ReplyTo = new MailAddress("name@mydomain.com");
mailMsg.Subject = "New contact message from site";
mailMsg.Body = string.Format("Name: {0}<br /><br /> Phone number: {1}<br /><br /> Email: {2}<br /><br />" +
"Subject:{3}", name, phone ?? "None provided", from, subject);
mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
smtp.Send(mailMsg);