using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
namespace QMFrameWork.Mail
{
///
/// 邮件发送接口
///
public class MailHelper
{
#region 属性
///
/// 邮件服务器地址
///
public static string SmtpServer { set; get; }
///
/// 发送人用户
///
public static string SenderUser { set; get; }
///
/// 发送人密码
///
public static string SenderPassword { set; get; }
///
/// 邮件服务器
///
public static string DoMain { set; get; }
///
/// 发件人邮箱
///
public static string SenderUserEmail { set; get; }
#endregion
#region 标准邮件发送接口
///
/// 发送邮件
///
public void SendMailForServer(MailInfo MailInfo, SmtpServerInfo ServerInfo)
{
//没有传的邮件服务器信息为空时用系统默认的构造一个
if (ServerInfo == null)
{
ServerInfo = new SmtpServerInfo(SmtpServer, SenderUser, SenderPassword, DoMain, SenderUserEmail);
}
SmtpMailSender sender = new SmtpMailSender(ServerInfo, MailInfo);
sender.Send();
}
///
/// 发送邮件
///
public void SendMail(MailInfo MailInfo, SmtpServerInfo ServerInfo)
{
//没有传的邮件服务器信息为空时用系统默认的构造一个
if (ServerInfo == null)
{
ServerInfo = new SmtpServerInfo(SmtpServer, SenderUser, SenderPassword, DoMain, SenderUserEmail);
}
SmtpMailSender sender = new SmtpMailSender(ServerInfo, MailInfo);
sender.Send();
}
#endregion
}
}