一、处理25端口
①、换用端口
2、云服务器可用端口。
1、可用端口(465、587)。
②、使用(465、587)端口问题
1、错误信息:The SMTP server requires a secure connection or the client was not authenticated.
2、错误信息: Bad sequence of commands. The server response was: Error: need EHLO and AUTH first
③、完整代码(处理及解决)
1、禁用默认凭证、启用ssl。
/// <summary> /// 发送邮件 /// </summary> /// <returns></returns> public async Task SendAsync() { MailMessage mail = new MailMessage(); mail.To.Add(new MailAddress("[email protected]")); mail.Body = "so far ~"; Mail.SmtpClient smtp = new Mail.SmtpClient(); mail.From = new MailAddress("[email protected]", "1764564459"); smtp.UseDefaultCredentials = false;//禁用默认凭证 smtp.EnableSsl = true;//启用ssl smtp.Host = "smtp.exmail.qq.com"; smtp.Port = 465; smtp.Credentials = new NetworkCredential("[email protected]", "password"); await smtp.SendMailAsync(mail); }
二、
①、
标签:25,端口,smtp,邮箱,new,mail,com From: https://www.cnblogs.com/study10000/p/17124962.html