/******************************************************
FileName:
Copyright (c) 2003-xxxx *********公司技术开发部
Writer:
create Date:2004-12-20
Rewriter:
Rewrite Date:
Impact:
Main Content:(Function Name、parameters、returns)
支持ESMTP, 多附件
******************************************************/
using System;
using System.Collections;
using System.Net.Sockets;
using System.IO;
using System.Text;
namespace Edu.Stu.Common.Mail
{
///<summary>
/// Module ID:0005
/// Depiction:发送邮件,支持ESMTP, 多附件
/// Wreter:Nick
/// Create Date;2004-12-20
///</summary>
public class MailSender
{
#region "Fields"
private string m_strFromName = "";
private string[] m_strTo = null;
private string m_strFrom = "";
private string m_strPassword = "";
private string m_strUserName = "";
private int m_iPort = 25;
private string m_strServer = "";
private int m_iPriority = 3;
private string m_strEncoding = "8bit";
private string m_strLanguageEncoding = "GB2312";
private bool m_bIsHTML = true;
private string m_strHTMLBody = "";
private string m_strTxtBody = "";
private string m_strSubject = "";
private string m_strToName = "";
private ArrayList m_alAttachments = new ArrayList ();
#endregion
#region "Propertes"
/// <summary>
/// SMTP服务器域名
/// </summary>
public string Server
{
get { return m_strServer; }
set { if (value != m_strServer) m_strServer = value; }
}
/// <summary>
/// SMTP服务器端口 [默认为25]
/// </summary>
public int Port {
get { return m_iPort; }
set { if (value != m_iPort) m_iPort = value; }
}
/// <summary>
/// 用户名 [如果需要身份验证的话]
/// </summary>
public string UserName
{
get { return m_strUserName; }
set { if (value != m_strUserName) m_strUserName = value; }
}
/// <summary>
/// 密码 [如果需要身份验证的话]
/// </summary>
public string Password
{
get { return m_strPassword; }
set { if (value != m_strPassword) m_strPassword = value; }
}
/// <summary>
/// 发件人地址
/// </summary>
public string From
{
get { return m_strFrom; }
set { if (value != m_strFrom) m_strFrom = value;}
}
/// <summary>
/// 收件人地址
/// </summary>
public string[] To
{
get { return m_strTo; }
set { if (value != m_strTo) m_strTo = value;}
}
/// <summary>
/// 发件人姓名
/// </summary>
public string FromName
{
get { return m_strFromName; }
set { if (value != m_strFromName) m_strFromName = value; }
}
/// <summary>
/// 收件人姓名
/// </summary>
public string ToName
{
get { return m_strToName; }
set { if (value != m_strToName) m_strToName = value; }
}
/// <summary>
/// 邮件的主题
/// </summary>
public string Subject
{
get { return m_strSubject; }
set { if (value != m_strSubject) m_strSubject = value; }
}
/// <summary>
/// 邮件正文
/// </summary>
public string Body
{
get { return m_strTxtBody; }
set { if (value != m_strTxtBody) m_