日期:2014-05-17 浏览次数:20490 次
private bool SendMailMethod(string account, string password, string host, int port, string title, string formAddress, string toAddress, string content)
{
try
{
MailMessage mm = new MailMessage(formAddress, toAddress, title, content);
//mm.CC.Add(new MailAddress(ccAddress));
mm.BodyEncoding = System.Text.Encoding.UTF8;
mm.IsBodyHtml = true;
//设置Smtp服务器信息
SmtpClient c = new SmtpClient(host, port);
////创建服务器认证
NetworkCredential NetworkCredential_my = new NetworkCredential(account, password);
//c.UseDefaultCredentials = true;
c.Credentials = new NetworkCredential(account, password);
c.DeliveryMethod = SmtpDeliveryMethod.Network;
//c.Timeout = 0;
c.Send(mm);
return true;
}
catch(Exception ex)
{
return false;
}
}
SendMailMethod(account, password, "smtp.qq.com", 25, "傲翼竞价宝用户密码找回", account, toAddress, content);