gpt4 book ai didi

c# - 无法从 gmail 中的雅虎服务器发送电子邮件正在工作

转载 作者:太空宇宙 更新时间:2023-11-03 18:41:47 24 4
gpt4 key购买 nike

为了发送电子邮件,我设置了服务器名称 smtp.mail.yahoo.com 并且端口是 465 我尝试发送电子邮件但未能发送电子邮件

使用 yahoo 发送电子邮件的正确服务器名和 smtp 端口是什么

我还需要设置哪些其他配置?

我的代码在这里:

  System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();


message.To.Add(address);
message.Subject = subject;
message.From = new System.Net.Mail.MailAddress(from);
message.Body = body;
message.Bcc.Add(bcc);
message.CC.Add(cc);
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.mail.yahoo.com");
smtp.Credentials = new System.Net.NetworkCredential(emailid,password);
smtp.Port = 465;
smtp.EnableSsl = true;
smtp.Send(message);

最佳答案

我刚试过代码,我认为雅虎邮件服务器不使用 SSL,因为如果你注释掉

 //smtp.Port = 465;
//smtp.EnableSsl = true;

有效。

关于c# - 无法从 gmail 中的雅虎服务器发送电子邮件正在工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8007510/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com