using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using System.Net.Mail;
using System.Net;
namespace Web.Common
{
///<summary>
/// 找回密码类
///</summary>
public class MyEmail
{
#region 找回密码
///<summary>
/// 功能:用户找回密码
///</summary>
///<param name="ToEmail">目的地地址</param>
///<param name="memberid">会员ID</param>
///<returns></returns>
public static bool SendMail(string ToEmail,string memberid)
{
string Email = "m.sh.lin0328@163.com";
string password = "abcd";
Encoding EnCode = Encoding.UTF8;
System.Net.Mail.MailMessage Message = new System.Net.Mail.MailMessage();
Message.From = new MailAddress(Email, "新郑网购会员管理中心", EnCode);
Message.To.Add(new MailAddress(ToEmail, "尊敬的用户", EnCode));
Message.Subject = "新郑网购网找回密码";
Message.SubjectEncoding = EnCode;
//CC为抄送,即发给用户的同时,再发送给Email
//Message.CC.Add(new MailAddress(Email,"房产巴巴网"));
StringBuilder MailContent = new StringBuilder();
MailContent.Append("尊敬的用户:<br/>");
MailContent.Append(" 您好!你于");
MailContent.Append(DateTime.Now.ToLongTimeString());
MailContent.Append("通过<a href='http://www.cnblogs.com/shanlin/archive/2011/10/10/#'>新郑网购</a>管理中心审请找回密码。");
MailContent.Append("<br/> 为了安全起见,请用户点击以下链接重设个人密码:");
string url = "http://www.hnjcg.com/getPass.aspx?memberid=" + memberid + "&email=" + ToEmail;
MailContent.Append("<br/> <a href='http://www.cnblogs.com/shanlin/archive/2011/10/10/" + url + "'>" + url + "</a>");
Message.Body = MailContent.ToString();
Message.BodyEncoding = EnCode;
Message.IsBodyHtml = true;
try
{
SmtpClient smtp = new SmtpClient("smtp.163.com", 25);
smtp.Credentials = new NetworkCredential(Email, password);
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(Message);
}
catch (Exception)
{
return false;
}
finally
{
Message.Dispose();
}
return true;
}
#endregion
}
}
.net邮箱找回密码
最新推荐文章于 2022-06-26 08:12:33 发布