日期:2013-05-09  浏览次数:20517 次

-------------------------调用类 -----------------------------------
private void SendMaill(string username,string superpassword,string email) {
string body="尊敬的用户:<br><br>您好!<br><br>  你的登录用户名是:"+username+"这是你的超级密码:"+superpassword
+"为了您的账号安全,我们建议您在收到邮件的72小时之内,到官方网站进行修改,并把该邮件删除。"
+"<br><br>"
+" 如有任何疑问,欢迎致电×××××发展有限责任公司客服热线:028-×××××××,我们将热情为您解答。"
+" 感谢您的支持!<br><br>"
+"                                          ××××××发展有限责任公司<br><br>"
+"                                          "+System.DateTime.Now.Year+"年"+System.DateTime.Now.Month+"月"+System.DateTime.Now.Day+"日<br><br>"
+"                                          官网:http://www.×××××.com<br><br>"
+"                                          ××××:http://www.××××.com";

lion_office.Data.Library.MailClass.ESmtpMail sm=new lion_office.Data.Library.MailClass.ESmtpMail();
sm.Send("mail.××××.com",
"×××@××××.com",
"××客服",
email,
username,
true,
"×××官方网站密码找回邮件",
body
);

Session.Remove("dd");
Response.Redirect("FindSPassOK.aspx");
}


-------------------------基类---------------------

using System;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Collections;

namespace lion_office.Data.Library.MailClass
{
/*
Create By lion
2002-11-20 01:44
Copyright (C) 2001,2002 www.LionSky.Net. All rights reserved.
Web: http://www.Lionsky.net ;;
Email: lion-a@sohu.com
Support .Net Framework Beta 2
*/
public class ESmtpMail
{
private string enter="\r\n";
/// <summary>
/// 设定语言代码,默认设定为GB2312,如不需要可设置为""
/// </summary>
public string Charset="GB2312";
/// <summary>
/// 发件人地址
/// </summary>
public string From="";
/// <summary>
/// 发件人姓名
/// </summary>
public string FromName="";
/// <summary>
/// 回复邮件地址
/// </summary>
//public string ReplyTo="";
/// <summary>
/// 收件人姓名
/// </summary>
public string RecipientName="";
/// <summary>
/// 收件人列表
/// </summary>
private Hashtable Recipient=new Hashtable();
/// <summary>
/// 邮件服务器域名
/// </summary>
private string mailserver="";
/// <summary>
/// 邮件服务器端口号
/// </summary>