SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应是:5.5.1 [英] The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1
本文介绍了SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应是:5.5.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到错误: SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。了解更多...
C#代码
I got error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at ...
C# code
protected void btnSubmit_Click(object sender, EventArgs e)
{
string strcon = ConfigurationManager.ConnectionStrings["prakashConnectionString2"].ConnectionString;
con = new SqlConnection(strcon);
con.Open();
SqlCommand cmd = new SqlCommand("SELECT username,password FROM getezee Where mail= '" + txtEmail.Text.Trim() + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
if (ds.Tables[0].Rows.Count > 0)
{
MailMessage Msg = new MailMessage();
Msg.From = new MailAddress("prakashzon@gmail.com");
Msg.To.Add(txtEmail.Text);
Msg.Subject = "Your Password Details";
Msg.Body = "Hi, <br />Please check your Login Detailss<br /><br />Your Username: " + ds.Tables[0].Rows[0]["username"] + "<br /><br />Your Password: " + ds.Tables[0].Rows[0]["password"] + "<br /><br />";
Msg.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.Credentials = new System.Net.NetworkCredential("getezee.social@gmail.com", "Risingstar");
smtp.EnableSsl = true;
smtp.Send(Msg);
lbltxt.Text = "Your Password Details Sent to your mail";
txtEmail.Text = "";
}
else
{
lbltxt.Text = "The Email you entered not exists.";
}
asp.code
asp.code
<div>
<table cellspacing="2" cellpadding="2" border="0" class="auto-style18">
<tr><td class="auto-style20"></td><td class="auto-style20"><b>Forgot Password</b></td></tr>
<tr><td><b>Enter Your Email:</b></td><td><asp:TextBox ID="txtEmail" runat="server" /></td></tr>
<tr><td class="auto-style19"></td><td class="auto-style19"><asp:button ID="btnSubmit" Text="Submit" runat="server" CssClass="Button" OnClick="btnSubmit_Click"/></td></tr>
<tr><td colspan="2" style=" color:red"><asp:Label ID="lbltxt" runat="server"/></td></tr>
</table>
</div>
推荐答案
直接更改gmail帐户中的设置以获得安全低级
To change setting in gmail accounts directly for secure Low
这篇关于SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应是:5.5.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文