服务器响应是:5.7.57 SMTP;客户端未经过身份验证,无法在MAIL FROM期间发送匿名邮件 [英] The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
本文介绍了服务器响应是:5.7.57 SMTP;客户端未经过身份验证,无法在MAIL FROM期间发送匿名邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须使用我的网络应用程序发送邮件。鉴于以下代码显示错误。错误是: SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应是:5.7.57 SMTP;客户端未通过身份验证,无法在MAIL FROM 期间发送匿名邮件。帮我找一个合适的解决方案。谢谢。
I have to send mail using my web application. Given below code showing error. The error is : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM. Help me to find a proper solution. Thank you.
protected void btnsubmit_Click(object sender, EventArgs e)
{
Ticket_MailTableAdapters.tbl_TicketTableAdapter tc;
tc = new Ticket_MailTableAdapters.tbl_TicketTableAdapter();
DataTable dt = new DataTable();
dt = tc.GetEmail(dpl_cate.SelectedValue);
foreach (DataRow row in dt.Rows)
{
string eml = (row["Emp_Email"].ToString());
var fromAddress = "emailAddress";
var toAddress = eml;
const string fromPassword = "*****";
string body = "Welcome..";
// smtp settings
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.office365.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.UseDefaultCredentials = false;
smtp.Timeout = 600000;
}
// Passing values to smtp object
smtp.Send(fromAddress, toAddress, subject, body);
}
}
}
推荐答案
put smtp.UseDefaultCredentials = false;在smtp.Credentials赋值之上。
Put smtp.UseDefaultCredentials = false; above the smtp.Credentials assignment.
另外,请确保您使用该帐户的实际office365电子邮件地址。您可以通过单击Outlook365中的配置文件按钮找到它。我一直在进行身份验证,直到我意识到我尝试用于身份验证的电子邮件地址不是实际的邮箱电子邮件帐户。它可能具有以下形式:account@company.onmicrosoft.com。
Also, be sure you're using the actual office365 email address for the account. You can find it by clicking on the profile button in Outlook365. I wrestled with authentication until I realized the email address I was trying to use for authentication wasn't the actual mailbox email account. it may have the form of: account@company.onmicrosoft.com.
在我尝试了所有这些建议但没有运气的情况下,我联系了Microsoft支持,他们的建议是简单地改变密码。
这解决了我的问题。
请注意,密码未过期,因为我成功登录office365,但重置解决了问题。
In my case after I tried all this suggestion without luck, I contacted Microsoft support, and their suggestion was to simply change the password.
This fixed my issue.
Note that the password wasn't expired, because I logged on office365 with success, however the reset solved the issue.
这篇关于服务器响应是:5.7.57 SMTP;客户端未经过身份验证,无法在MAIL FROM期间发送匿名邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文