SMTP服务器要求安全连接或客户端未通过身份验证。服务器响应为:5.5.1需要验证 [英] The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required

查看:221
本文介绍了SMTP服务器要求安全连接或客户端未通过身份验证。服务器响应为:5.5.1需要验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,当IM通过这个代码,那么错误发生在发送邮件SMTP服务器要求安全连接或客户端未通过身份验证服务器响应为:5.5.1需要身份验证



和我的代码是:

 保护无效ImageButton1_Click(对象发件人,ImageClickEventArgs E)
{

邮件MAILMESSAGE新= MAILMESSAGE();
mail.To.Add(info@msslindia.com);
mail.From =新的MailAddress(info@msslindia.com);
绳体=<表>< TR>< TD>公司名称:< / TD>< TD>中+ txt_cname.Text +&下; / TD>&下; / TR>&下; TR>&下; TD>地址随着No.:</td><td> + txt_addwithno.Text +< / TD>< / TR>< TR>< TD>联系人:< / TD>< TD>中+ txt_conperson.Text +< / TD>< / TR>< TR>< TD>电子邮件ID< / TD>< TD>中+ txt_email.Text +< / TD>< / TR>< TR>< TD>简介< / TD>< TD>中+ txt_description.Text +< / TD>< / TR>< /表>,
mail.Body =身体;
mail.IsBodyHtml = TRUE;
SmtpClient SMTP =新SmtpClient();
smtp.Host =smtp.gmail.com;
smtp.Port = 25;
smtp.UseDefaultCredentials = TRUE;
smtp.Credentials =新System.Net.NetworkCredential(info@msslindia.com,XYZ);
smtp.EnableSsl = TRUE;
smtp.Send(邮件);


txt_cname.Focus();
txt_cname.Text =;
txt_addwithno.Text =;
txt_conperson.Text =;
txt_email.Text =;
txt_description.Text =;

}


解决方案

谷歌可能阻止应用程序访问您的帐户

在这里,您可以使应用程序与你的凭证来访问谷歌帐户:



https://accounts.google.com/DisplayUnlockCaptcha


I have a Problem, when i m sending a mail through this code then error is occured that "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. "

and my code is :

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{

    MailMessage mail = new MailMessage();
    mail.To.Add("info@msslindia.com");
    mail.From = new MailAddress("info@msslindia.com");
    string body = "<table><tr><td>Company Name:</td><td>" + txt_cname.Text + "</td></tr><tr><td>Address With No.:</td><td>" + txt_addwithno.Text + "</td></tr><tr><td>Contact Person:</td><td>" + txt_conperson.Text + "</td></tr><tr><td>Email Id</td><td>" + txt_email.Text + "</td></tr><tr><td>Description</td><td>" + txt_description.Text + "</td></tr></table>";
    mail.Body = body;
    mail.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient();
    smtp.Host = "smtp.gmail.com";
    smtp.Port = 25;
    smtp.UseDefaultCredentials = true;
    smtp.Credentials = new System.Net.NetworkCredential("info@msslindia.com", "xyz");
    smtp.EnableSsl = true;
    smtp.Send(mail);


    txt_cname.Focus();
    txt_cname.Text = "";
    txt_addwithno.Text = "";
    txt_conperson.Text = "";
    txt_email.Text = "";
    txt_description.Text = "";

}

解决方案

Google may prevent an application from accessing your account
Here you can enable applications to access google account with your credentials:

https://accounts.google.com/DisplayUnlockCaptcha

这篇关于SMTP服务器要求安全连接或客户端未通过身份验证。服务器响应为:5.5.1需要验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆