我在发送邮件时收到错误。“SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。了解更多信息,请访问“ [英] I am getting error while sending mail.."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"

查看:194
本文介绍了我在发送邮件时收到错误。“SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。了解更多信息,请访问“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在发送电子邮件时收到错误



SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。了解更多





plz帮助我



我的代码是





protected void Btn_Submit_Click(object sender,EventArgs e)

{

string style =;

// string uid = System.Configuration.ConfigurationSettings.AppSettings [gmailid]。ToString();

// string mailfromid = System.Configuration.ConfigurationSettings.AppSettings [noreplyid]。ToString();

// string mailfrompwd = System.Configuration.ConfigurationSettings.AppSettings [noreplypwd]。ToString(); < br $>


string uid = System.Configuration.ConfigurationSettings.AppSettings [gmailid]。ToString();

string mailfromid = System.Configuration。 ConfigurationSettings.AppSettings [noreplyid]。ToString();

string mailfrompwd = System.Configuration.ConfigurationSettings.AppSettings [noreplypwd]。ToString();



string Body =组织细节:我们为你的问题提供解决方案Vedeye ... ;

string Subject =你成功了订阅了epaper的下标....;



电子邮件(uid,mailfromid,mailfrompwd,正文,主题);



}



public void Email( string from,string frompwd,string to,string body,string subject)

{



MailMessage mail = new MailMessage();

mail.From = new MailAddress(from);

mail.IsBodyHtml = true;

NetworkCredential mailAuthentication = new NetworkCredential(from,frompwd);

SmtpClient smtp =新的SmtpClient(smtp.gmail.com,587);

smtp.EnableSsl = true;

smtp.UseDefaultCredentials = false;

smtp.Credentials = mailAuthentication;

mail.To.Add(new MailAddress(txtmail.Text.Trim()));

mail.Subject = subject;

mail.Body = body;

smtp.Send(mail);







}

i am getting error while sending email

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more


plz help me

my code is


protected void Btn_Submit_Click(object sender, EventArgs e)
{
string style = "";
//string uid = System.Configuration.ConfigurationSettings.AppSettings["gmailid"].ToString();
//string mailfromid = System.Configuration.ConfigurationSettings.AppSettings["noreplyid"].ToString();
//string mailfrompwd = System.Configuration.ConfigurationSettings.AppSettings["noreplypwd"].ToString();

string uid = System.Configuration.ConfigurationSettings.AppSettings["gmailid"].ToString();
string mailfromid = System.Configuration.ConfigurationSettings.AppSettings["noreplyid"].ToString();
string mailfrompwd = System.Configuration.ConfigurationSettings.AppSettings["noreplypwd"].ToString();

string Body = "Organization Details : Vedeye the astrologer we provide solution to your problems...";
string Subject = "You have succefully Subscribed the epaper subscriptuion....";

Email(uid, mailfromid, mailfrompwd, Body, Subject);

}

public void Email(string from, string frompwd, string to, string body, string subject)
{

MailMessage mail = new MailMessage();
mail.From = new MailAddress(from);
mail.IsBodyHtml = true;
NetworkCredential mailAuthentication = new NetworkCredential(from, frompwd);
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = mailAuthentication;
mail.To.Add(new MailAddress(txtmail.Text.Trim()));
mail.Subject = subject;
mail.Body = body;
smtp.Send(mail);



}

解决方案

你可以用这个链接交叉检查

http://www.aspdotnet-suresh.com/2010/11/introduction-this-article-i-will.html [ ^ ]



希望这有助于你我不确定你哪里出错了,但是这个链接提供的代码可能对你有帮助。
Can u cross check with this link
http://www.aspdotnet-suresh.com/2010/11/introduction-this-article-i-will.html[^]

hope this helps u I am not sure where u went wrong, but the code provided in this link might helps you.


这篇关于我在发送邮件时收到错误。“SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。了解更多信息,请访问“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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