特点:
1. 支持SMTP验证
2. 支持群发功能
3. 支持各种免费邮箱,如sohu,163等
4. 支持Win2k Server自带的smtp服务器,即只要你联网,配置好smtp服务器,即可本机发邮件
5. 完整的错误代码,拥有Logs和HTMLlogs两个日志功能,可以输出详细的服务器--客户端交互日志
代码如下:
----------------------------------------------
using System;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Collections;
namespace Sanxing.Mail.Data
{
public class ESmtpMail
{
//内部变量
///
/// 设置换行变量
///
private string enter="\r\n";
///
/// 设定语言代码,默认设定为GB2312,如不需要可设置为""
///
private string Charset="GB2312";
///
/// 发件人地址
///
private string From="";
///
/// 发件人姓名
///
private string FromName="";
///
/// 回复邮件地址
///
//public string ReplyTo="";
///
/// 收件人姓名
///
private string RecipientName="";
///
/// 收件人列表
///
private Hashtable Recipient=new Hashtable();
///
/// 邮件服务器域名
///
private string mailserver="";
///
/// 邮件服务器端口号
///
private int mailserverport=25;
///
/// SMTP认证时使用的用户名
///
private string username="";
///
/// SMTP认证时使用的密码
///
private string password="";
///
/// 是否需要SMTP验证
///
private bool ESmtp=false;
///
/// 是否Html邮件
///
private bool Html=false;
///
/// 邮件附件列表
///
private System.Collections.ArrayList Attachments;
///
/// 邮件发送优先级,可设置为"High","Normal","Low"或"1","3","5"
///
private string priority="Normal";
///
/// 邮件主题
///
private string Subject="";
///
/// 邮件正文
///
private string Body="";
///
/// 收件人数量
///
private int RecipientNum=0;
///
/// 最多收件人数量
///
private int recipientmaxnum=1;
///
/// 密件收件人数量
///
//private int RecipientBCCNum=0;
///
/// 错误消息反馈
///
private string errmsg;
///
/// TcpClient对象,用于连接服务器
///
private TcpClient tc;
///
/// NetworkStream对象
///
private NetworkStream ns;
///
/// SMTP错误代码哈希表
///
private Hashtable ErrCodeHT = new Hashtable();
///
/// SMTP正确代码哈希表
///
private Hashtable RightCodeHT = new Hashtable();
///
/// 服务器交互记录
///
private string logs="";
///
///HTML格式的服务器交互记录
///
private string htmllog="";
-------------------------------------
代码第一部分完毕

