从我的localhost Web应用程序发送测试邮件时,下面提到的asp.net代码有什么问题?
错误:SMTP服务器需要安全连接或客户端未经过身份验证.服务器响应为:5.7.1需要身份验证
string smtpAddress = "smtp.mail.yahoo.com";
int portNumber = 587;
bool enableSSL = true;
string emailFrom = "abcdefg@gmail.com";
string password = "12345";
string emailTo = "zyxw@gmail.com";
string subject = "Hello";
string body = "Hello, I'm just writing this to say Hi!";
using (MailMessage mail = new MailMessage())
{
mail.From = new MailAddress(emailFrom);
mail.To.Add(emailTo);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = true;
// Can set to false, if you are sending pure text.
using (SmtpClient smtp = new SmtpClient(smtpAddress, …
Run Code Online (Sandbox Code Playgroud)