Send Error:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
来源:互联网 发布:剑灵怎样导入捏脸数据 编辑:程序博客网 时间:2024/04/29 21:00
使用asp.net 2.0 中新的System.Net.Mail发送邮件,使用163邮件服务器时等其他服务器时可能会出现:“Send Error:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required”错误,以下程序中红色为特别需要主要的地方。
protected void Button1_Click(object sender, EventArgs e)
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
//收件人
message.To.Add(txtMailAddress.Text);
//抄送
foreach(string mailAddress in txtCopyAddress.Text.Split(','))
{
if (!string.IsNullOrEmpty(mailAddress))
{
message.CC.Add(mailAddress);
}
}
//主题
message.Subject = txtSubject.Text;
message.From = new System.Net.Mail.MailAddress(fromAddress);
message.Body = txtMailContents.Text;
//发送附件
if (fulAttachment.HasFile)
{
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(fulAttachment.PostedFile.FileName);
message.Attachments.Add(attachment);
}
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(txtSMTPAddress.Text);
smtp.Credentials = new System.Net.NetworkCredential(txtUserName.Text,txtPassword.Text);
//smtp.usedefaultcredentials = true;
try
{
smtp.Send(message);
lblReturnMessage.Text = "Mail Send Success!";
}
catch (System.Net.Mail.SmtpException ex)
{
lblReturnMessage.Text = "Send Error:" + ex.Message;
}
}
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
//收件人
message.To.Add(txtMailAddress.Text);
//抄送
foreach(string mailAddress in txtCopyAddress.Text.Split(','))
{
if (!string.IsNullOrEmpty(mailAddress))
{
message.CC.Add(mailAddress);
}
}
//主题
message.Subject = txtSubject.Text;
message.From = new System.Net.Mail.MailAddress(fromAddress);
message.Body = txtMailContents.Text;
//发送附件
if (fulAttachment.HasFile)
{
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(fulAttachment.PostedFile.FileName);
message.Attachments.Add(attachment);
}
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(txtSMTPAddress.Text);
smtp.Credentials = new System.Net.NetworkCredential(txtUserName.Text,txtPassword.Text);
//smtp.usedefaultcredentials = true;
try
{
smtp.Send(message);
lblReturnMessage.Text = "Mail Send Success!";
}
catch (System.Net.Mail.SmtpException ex)
{
lblReturnMessage.Text = "Send Error:" + ex.Message;
}
}
如果选择了163的SMTP服务器,“smtp.163.com”,发件人必须是登录用户的163 email用户地址。
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.163.com");
smtp.Credentials = new System.Net.NetworkCredential("163emailaddress","emailpassword");
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.From = new System.Net.Mail.MailAddress("163emailaddress@163.com");
smtp.Credentials = new System.Net.NetworkCredential("163emailaddress","emailpassword");
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.From = new System.Net.Mail.MailAddress("163emailaddress@163.com");
- Send Error:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
- Send Error:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
- Send Error:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
- smtpClient发邮件错误:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
- smtpClient发邮件错误:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
- 不允许使用邮箱名称。 服务器响应为:authentication is required
- 163邮箱发送邮件碰到:System.Net.Mail.SmtpException: 不允许使用邮箱名称。 服务器响应为:authentication is required
- JavaMail 553 You are not authorized to send mail
- 让国外邮件服务商不再拒收你的邮件,The IP you're using to send mail is not authorized
- The IP you're using to send email is not authorized
- HTTP Error 401.2 - You are not authorized to view this page due to invalid authentication headers
- [转]让国外邮件服务商不再拒收你的邮件,The IP you're using to send mail is not authorized
- 邮箱不可用。 服务器响应为: 5.7.1 Client does not have permissions to send as this sender
- you are not authorized to use service
- .Net使用SmtpClient发送邮件,报错:不允许使用邮箱名称。 服务器响应为: xxxw
- you are not authorized to use this service
- It is not safe to rely on the system's timezone settings. You are *required*
- send Mail
- java 简单的HttpClient工具类,解决返回中文有部分乱码的情况
- static函数与普通函数
- 【&Win7下手提电脑的电源图标消失了是怎么回事?&】
- 7. 微软亚院之编程判断俩个链表是否相交
- 【U盘主控芯片的优缺点】
- Send Error:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
- iOS 计算某个时间到现在是多少月/天/时的代码
- 格式化输出,不足位补位
- 重定向
- “#”预处理
- Android自动化程测试框架之Robotium VS. UIAutomator
- filter和interceptor的区别
- EGORefreshTableHeaderView下拉刷新(三)——自定义更新时间
- 【Win8 3大启动绝招 让你的电脑超速启动】