您好,登录后才能下订单哦!
#region 发送邮件到指定邮箱
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="to">收件人邮件地址</param>
/// <param name="from">发件人邮件地址</param>
/// <param name="subject">邮件主题</param>
/// <param name="body">邮件内容</param>
/// <param name="username">登录smtp主机时用到的用户名</param>
/// <param name="password">登录smtp主机时用到的用户密码</param>
/// <param name="smtpHost">发送邮件用到的smtp主机</param>
public string SendEmails(string to)
{
string mess = "";
try
{
string from ="XXX.com";//发件人邮件地址
stringuserName ="XXX.com";//发件人邮件地址
string password ="XXX";
stringsmtpHost ="smtp.exmail.qq.com";//腾讯
MailAddressfroms = new MailAddress(from);
MailAddress email = new MailAddress(to);
MailMessage message = newMailMessage(froms, email);
message.Subject = "忘记密码提示(XXXX)";//设置邮件主题
message.IsBodyHtml = true;//设置邮件正文为html格式
stringurl ="http://www.XXXX.aspx?flag=" + email;
message.Body = "尊敬的<spanstyle='color:#d20954'>" + email + "</span>,您好:<br><br/>您在(XX)点击了“忘记密码”按钮,故系统自动给您发送了这封邮件,您可以点击以下链接修改您的密码:<a title='点击马上登陆网站修改密码!' href='" + url + "' style='color:#d20954'target='_blank'>点击马上登陆网站修改密码!</a> ";//设置邮件内容
SmtpClient client = newSmtpClient(smtpHost);
client.UseDefaultCredentials = true;
////设置发送邮件身份验证方式
client.Credentials = newNetworkCredential(userName, password);
client.DeliveryMethod =SmtpDeliveryMethod.Network;
client.Send(message);
}
catch (Exception ex)
{
mess = newCommon.YKException().GetErrorInfo(ex, this);
}
return mess;
}
#endregion
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。