C#发送邮件异常:根据验证过程,远程证书无效

在尝试使用公司邮箱和SMTP发送邮件时遇到异常:'根据验证过程,远程证书无效'。通过查阅资料并解决,以下是解决方案。
摘要由CSDN通过智能技术生成

今天在做发送邮件功能时,开始用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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值