今天在做发送邮件功能时,开始用qq邮箱和163邮箱都可以正常发送,后再改用我公司的邮箱和smtp时竟然报错了。
异常提示-----“根据验证过程,远程证书无效”,后来通过查询资料解决该问题,上代码:
using log4net; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Mail; using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Text; namespace BLL { public class emailHandle { private string _serviceType = "SMTP"; private string _host; /// <summary> /// 发送者邮箱 /// </summary> public string From { get; set; } /// <summary> /// 接收者邮箱列表 /// </summary> public List<string> To { get; set; } /// <summary> /// 抄送者邮箱列表 /// </summary> public string[] Cc { get; set; } /// <summary> /// 秘抄者邮箱列表 /// </summary> public