public bool sendMail(string strSmtp,string from,string to,string userName,string Password,string caption,string subject)
{
try
{
MailAddress mailFrom = new MailAddress(from);
MailAddress mailTo = new MailAddress(to);
MailMessage msg = new MailMessage(mailFrom, mailTo);
msg.Subject = caption;
msg.IsBodyHtml = true;
msg.Body = subject;
SmtpClient client = new SmtpClient(strSmtp);
client.Credentials = new System.Net.NetworkCredential(userName, Password);
client.Send(msg);
return true;
}
catch (Exception e1)
{
System.Web.HttpContext.Current.Response.Write(e1.Message);
return false;
}
}
}
asp.net发送邮件
最新推荐文章于 2019-01-08 02:20:35 发布