我一直在努力爭取使用Godaddy發送郵件的正確語法。任何幫助,將不勝感激。我是否需要將代碼添加到我的web.config
?Godaddy發送郵件
System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage("[email protected]", "To", "subject ", "body ");
m.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net");
smtp.UseDefaultCredentials = true;
smtp.Send(m);
的錯誤信息是這樣的:
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:467
Source 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.
什麼似乎是問題? – 2011-12-19 19:46:53
它不發送郵件。我得到一個錯誤屏幕。我是否需要購買godaddy的可信度表格或什麼? – CsharpBeginner 2011-12-19 19:51:50
請編輯您的問題併發布錯誤。 – 2011-12-19 19:53:01