本文介绍了使用SMTP Godaddy服务器发送邮件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; using System.Net.Mime; public partial class _Default : System.Web.UI.Page { MailMessage mail = new MailMessage(); private void clear() { TextBox2.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; } protected void Button2_Click(object sender, EventArgs e) { { { MailMessage message = new MailMessage(); message.From = new MailAddress("[email protected]"); message.To.Add(new MailAddress("[email protected]")); message.Subject = "test"; message.Body = "This is test"; SmtpClient msg = new SmtpClient("relay-hosting.secureserver.net"); msg.Credentials = new System.Net.NetworkCredential("[email protected]", "***********"); msg.Port = 25; msg.EnableSsl = false; msg.Send(message); } } } }
错误:
邮箱名称不允许.服务器响应是:抱歉,您所在位置的中继拒绝[183.83.83.176](#5.7.1)
解决方案
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; using System.Net.Mime; public partial class _Default : System.Web.UI.Page { MailMessage mail = new MailMessage(); private void clear() { TextBox2.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; } protected void Button2_Click(object sender, EventArgs e) { { { MailMessage message = new MailMessage(); message.From = new MailAddress("[email protected]"); message.To.Add(new MailAddress("[email protected]")); message.Subject = "test"; message.Body = "This is test"; SmtpClient msg = new SmtpClient("relay-hosting.secureserver.net"); msg.Credentials = new System.Net.NetworkCredential("[email protected]", "***********"); msg.Port = 25; msg.EnableSsl = false; msg.Send(message); } } } }
Error:
Mailbox name not allowed. The server response was: sorry, relaying denied from your location [183.83.83.176] (#5.7.1)
解决方案
这篇关于使用SMTP Godaddy服务器发送邮件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!