[英]authentication error in sending mail from yahoo in c# windows application
i am trying to send email from my software using the smtp of yahoo but it shows the following error "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required".我正在尝试使用 yahoo 的 smtp 从我的软件发送电子邮件,但它显示以下错误“SMTP 服务器需要安全连接或客户端未通过身份验证。服务器响应为:5.7.1 需要身份验证”。
I know about the less secure apps setting in google but i don't know about the settings in yahoo.我知道谷歌中不太安全的应用程序设置,但我不知道雅虎中的设置。 the same code runs fine with the gmail account credentials.
相同的代码使用 gmail 帐户凭据运行良好。 here is the code for reference.
这是参考代码。
string EmailFrom = "test@yahoo.com";
string EmailTo = "test@gmail.com";
string PassWord = "test123";
string EmailHost = "smtp.mail.yahoo.com";
string status = "";
string Body = "";
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress(EmailFrom);
message.To.Add(new MailAddress(EmailTo));
message.Subject = "Auto Backup at test" ;
message.Body = "Backup has been taken at test on" + DateTime.Now;
Body = "Backup has been taken at test on" + DateTime.Now;
smtp.Port = 587;
smtp.Host = EmailHost;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(EmailFrom, PassWord);
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
//ServiceLogLibrary.WriteErrorlog("Step:5");
//Library.WriteErrorlog("Before sending mail");
smtp.Send(message);
Just providing some more information here as things have changed a little since the accepted answer was posted.仅在此处提供更多信息,因为自接受的答案发布以来,情况发生了一些变化。
You need to go to你需要去
Source: Temporarily allow or deny access to apps using older security sign in来源:暂时允许或拒绝使用旧安全登录的应用程序访问
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.