废话不多直接上类
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Text.RegularExpressions;
namespace TEST
{
/// <summary>
/// 发送邮件
/// </summary>
public class MailSender
{
/// <summary>
/// 发送html邮件
/// </summary>
/// <param name="configSetting">发送信息</param>
/// <param name="recipient">接收人邮件</param>
/// <param name="subject">主题</param>
/// <param name="body">邮件正文</param>
/// <param name="isAuthentication">是否验证身份</param>
/// <param name="isAutograph">是否加入邮件签名</param>
/// <param name="isBodyHtml">正文是否HTML</param>
/// <param name="encoding">邮件编码方式 默认UTF-8</param>
/// <param name="fileInline">附近是否嵌入邮件正文</param>
/// <param name="files">附近地址集合</param>
public static bool Send(SmtpSetting configSetting, string recipient, string subject, string body, bool isAuthentication, bool isAutograph = true, bool isBodyHtml = false, Encoding encoding = null, List<string> files = null, bool fileInline = false)
{
SmtpClient smtpClient = new SmtpClient(configSetting.Host);
if (configSetting.Port != -1)
{
smtpClient.Port = configSetting.Port;
}
if (encoding =