I’ve been struggling with getting this syntax right to send mail using Godaddy. Any help would be appreciated. Do I need to add code to my web.config?
System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage("MygodaddyEmail@asdf.com", "To", "subject ", "body ");
m.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net");
smtp.UseDefaultCredentials = true;
smtp.Send(m);
The error message is this:
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
173.201.192.101:467 Description: An unhandled exception occurred during the execution of the current web request. Please review the
stack trace for more information about the error and where it
originated in the code.Exception Details: System.Net.Sockets.SocketException: 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 173.201.192.101:467Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
I was able to figure out how to do this and it works. Code is below for others having the same issue.