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. Learn more at
问题描述
在应用程序中工作时,它正常工作并接收邮件。当托管邮件发送失败时,我收到错误,如 SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要验证。了解更多信息请帮帮我
我的代码是
when working in the application it is working fine and receiving mail. when it is hosted message sending failed and i am getting the error like "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" please help me
my code is
try
{
MailMessage Msg = new MailMessage();
// Sender e-mail address.
Msg.From = new MailAddress(txtemail.Text);
// Recipient e-mail address.
Msg.To.Add("manojmuraliconnect@gmail.com");
Msg.Subject = "Enquiry";
Msg.Body = "Sender : " + txtemail.Text + "\n" + "Name : " + txtname.Text + "\n" + "Phone : " + txtphone.Text + "\n" + "Address:" + txtaddress.Text + "\n" + "Enquiry:" + txtenquiry.Text;
// your remote SMTP server IP.
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential("manojmuraliconnect@gmail.com", "Password");
smtp.EnableSsl = true;
smtp.Send(Msg);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ASET", "<script type='text/javascript'>alert('Your Message Has Been Send ');</script>", false);
CleaContents();
}
catch (Exception ex)
{
lbltext.Text = ex.Message;
}
推荐答案
查看:
Look at:
Msg.From = new MailAddress(txtemail.Text);
...
smtp.Credentials = new System.Net.NetworkCredential("manojmuraliconnect@gmail.com",
如果 txtemail.Text
与manojmuraliconnect@gmail.com
不同,Google不接受该消息:您不得代表其他人发送电子邮件(许多邮件服务器)以这种方式配置:没有提供商喜欢垃圾邮件发送者。)
If txtemail.Text
is different from "manojmuraliconnect@gmail.com"
, Google will not accept that message: you must not send an email on behalf of someone else (many mail servers are configured in this way: no provider likes spammers).
您也可以查看这些链接,希望这些能帮助您...
http://social.msdn.microsoft.com/Forums/en-US/fcde2033-2f83-46d5-911b-767023bfef93/smtpclientsend-gets-smtpexception-551-authentication-required-error?forum=netfxnetcom [ ^ ]
http ://stackoverflow.com/questions/17227532/gmail-530-5-5-1-authentication-required-learn-more-at [ ^ ]
you can also check these links hope these are help you...
http://social.msdn.microsoft.com/Forums/en-US/fcde2033-2f83-46d5-911b-767023bfef93/smtpclientsend-gets-smtpexception-551-authentication-required-error?forum=netfxnetcom[^]
http://stackoverflow.com/questions/17227532/gmail-530-5-5-1-authentication-required-learn-more-at[^]
需要非常强大的密码,
我将帐户的密码更改为:%TGB6yhn ^ YHN5tgb,它完美无缺。
Very Strong Password is needed,
I changed my Account's Password to somthing like: %TGB6yhn^YHN5tgb and it works perfect.
这篇关于SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。了解更多信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!