关于发送EMAIL

plo2168424 plo2168424 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的Web程序调用这个函数

public bool Send(string SmtpServer, int Port, string UserName, string PassWord, string ADDRESS_FROM, string add_to, string title, string body)
{
DataSet ds = new DataSet();
SmtpClient mailClient = new SmtpClient(SmtpServer, Port);
mailClient.EnableSsl = true;
NetworkCredential crendetial = new NetworkCredential(UserName,PassWord);
mailClient.Credentials = crendetial;

MailMessage message = new MailMessage(ADDRESS_FROM, add_to, title, body);
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
message.SubjectEncoding = System.Text.Encoding.UTF8;

try
{
mailClient.Send(message);
return true;
}
catch
{
return false;
}
}


SmtpServer="stmp.163.com" Port=25

运行错误提示:服务器不支持安全连接 这是什么意思上啊?哪错了?还是什么东西没配置?
...全文
评论 3
收藏 已收藏
分享
返回顶部
plo2168424
.NET社区 62,274 成员 668,968 内容