Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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);
Posted
Updated 8-Jan-15 15:54pm
v2
Comments
Sergey Alexandrovich Kryukov 8-Jan-15 21:37pm    
Yes, it must be on your end, daddy is probably right. And none of us can see this "end" in the text of your question. No, let me tell you: you haven't not "read just about every article that Google offers", and maybe you didn't have to. :-) There are too many ways to screw up things this way...
—SA
Richard C Bishop 8-Jan-15 21:46pm    
Good to hear from you Sergey! I of course did not provide many details in an effort to get a different set of info. I will go ahead and add the code I have and some of what I have attempted.
Sergey Alexandrovich Kryukov 8-Jan-15 21:50pm    
Please look thoroughly what could be wrong. Any absolute URL's, missing files. Note that 198.37.144.225:587 is not the address on the Web; this is the key. Find out where it comes from.
—SA
Richard C Bishop 8-Jan-15 21:58pm    
Ok, so I pinged that IP and it belongs to SendGrid. SendGrid is a product that was recommended to send emails. I tried it and did not get it to work so I removed the code and references to it, so that is bizzare it would be doing that.
Sergey Alexandrovich Kryukov 8-Jan-15 22:03pm    
Apparently, this IP is not good in principle. You have to get rid of it. Now the problem is reduced to what to do instead. Is it a problem?
—SA

1 solution

Hello,

I use godaddy and this is what I do, it works perfectly:

SmtpClient client = new SmtpClient(host);
NetworkCredential credentials = new NetworkCredential(user, password);

client.UseDefaultCredentials = false;
client.Credentials = credentials;

client.Send(message);


my host is smtpout.europe.secureserver.net and the port is 3535

Valery.
 
Share this answer
 
Comments
Richard C Bishop 9-Jan-15 9:52am    
Thank you! I will give it a try and report back. Are there any settings in the web.config you are using?
Valery Possoz 9-Jan-15 14:15pm    
I've put the host, password, user and port in the appsettings section. Also I'm in the UK so the server is smtpout.europe.secureserver.net not the US one smtpout.secureserver.net
Richard C Bishop 9-Jan-15 20:57pm    
Thank you very much. Your answer lead me to figure it out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900