asp.net发送邮件
2010-07-27 13:19
337 查看
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;
}
}
}
{
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开发邮件发送系统
- asp.net 发送邮件
- ASP.NET MVC通过发送邮件激活注册用户
- asp.net mvc 邮件发送
- 在ASP.NET Core 中发送邮件的实现方法(必看篇)
- asp.net发送邮件实现方法
- ASP.NET定时发送邮件总结
- ASP.NET用QQ,网易发送邮件以及添加附件
- ASP.NET C# 邮件发送全解
- 如何使用ASP .Net发送邮件
- 一个简单的基于System.Web.Mail的ASP.Net邮件发送程序
- asp.net发送邮件代码
- asp.net发送邮件程序[转贴]
- asp.net发送邮件
- Asp.net发送邮件的两种方法
- ASP.NET MVC通过发送邮件激活注册用户
- asp.net 发送邮件 (system.web.mail Jmail)
- asp.net发送邮件
- 在ASP.NET中使用SmtpClient发送邮件
- 另外一个ASP.NET 实现邮件发送和接受的功能(Sockets)