C# SMTP email sending code fails for Yahoo Mail but works fine for other servers, can anyone help?

后端 未结 5 2121
孤城傲影
孤城傲影 2020-12-16 23:26

I am using this code to send an SMTP email via the yahoo SMTP server, it is for a personal project I am writing.

using System.Net.Mail;
using System.Net;

Sm         


        
5条回答
  •  难免孤独
    2020-12-16 23:35

    Port 465 isn't supported by System.Net.Mail.SmtpClient.

    http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.enablessl.aspx

    From the Remarks Section:

    This connection method is sometimes called SMTP/SSL, SMTP over SSL, or SMTPS and by default uses port 465. This alternate connection method using SSL is not currently supported.

    Edit: You could try using port 587 instead (if Yahoo supports it).

提交回复
热议问题