使用asp.net发送邮件时出错 [英] Getting error while sending a mail using asp.net
本文介绍了使用asp.net发送邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨frds,
使用asp.net发送邮件时出错...我尝试了很多编码来发送邮件但是没有工作..
i尝试过这样的事情
hi frds,
Getting error while sending a mail using asp.net .. i have tried many coding's to send mail but not working ..
i have tried like this
msg.From = new MailAddress("test@gmail.com");
msg.To.Add("test@gmail.com");
msg.Subject = "test";
msg.Body = "Test Content";
//msg.Priority = MailPriority.High;
using (SmtpClient client = new SmtpClient())
{
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("test@gmail.com", "test");
client.Host = "smtp.gmail.com";
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(msg);
}
收到错误
its getting an error that
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
请给我使用gmail凭证发送邮件的代码 ..请帮助我..
感谢您的建议..
mani ..
Please give me the code to send the mail using gmail credentials ..please help me ..
thanks in advice..
mani..
推荐答案
>
1) https://accounts.google.com/DisplayUnlockCaptcha //点击允许访问您的Google帐户
2)您必须启用从其他时区/ IP登录您的Google帐户。
要做请点击 https://g.co/allowaccess 链接,然后点击继续按钮进行访问。
3)转到以下链接中的安全设置: https://www.google.com/settings/security/lesssecureap ps 并启用安全性较低的应用。这样您就可以从所有应用程序登录。
参考: 5.5.1需要验证
Hi,
1) https://accounts.google.com/DisplayUnlockCaptcha //Click allow access to your Google account
2) You have to enable login from other timezone / ip for your google account.
to do this follow the link https://g.co/allowaccess and allow access by clicking the continue button.
3) go to security settings at the followig link https://www.google.com/settings/security/lesssecureapps and enable less secure apps . So that you will be able to login from all apps.
Ref : 5.5.1 Authentication Required
这篇关于使用asp.net发送邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文