关于.net发送EMAIL的总结
来源:互联网 发布:长海医院 人工智能 编辑:程序博客网 时间:2024/06/02 06:33
- using System.Web.Mail;
- using System.Net.Mail;
- using System.Net;
- /// <summary>
- /// 发送EMail
- /// </summary>
- /// <param name="title">标题</param>
- /// <param name="body">内容</param>
- /// <param name="toAdress">发送到哪</param>
- /// <param name="fromAdress">从哪发送</param>
- /// <param name="userName">用户名</param>
- /// <param name="userPwd">密码</param>
- /// <param name="smtpHost">smtp服务器</param>
- private void sendMail(string title, string body, string toAdress, string fromAdress,
- string userName, string userPwd, string smtpHost)
- {
- try
- {
- MailAddress to = new MailAddress(toAdress);
- MailAddress from = new MailAddress(fromAdress);
- System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from, to);
- message.Subject = title; message.Body = body;
- SmtpClient smtp = new SmtpClient();
- smtp.UseDefaultCredentials = true;
- smtp.Port = 25;
- smtp.Credentials = new NetworkCredential(userName, userPwd);
- smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
- smtp.Host = smtpHost;
- message.To.Add(toAdress);
- smtp.Send(message);
- }
- catch (Exception ex) {
- Response.Write(ex.Message);
- }
- }
- 关于.net发送EMAIL的总结
- 使用.net发送Email总结
- 使用.net发送Email方法总结
- 利用.net的强大功能发送email
- 利用.net的强大功能发送email
- Asp.net(C#) 发送Email的用法
- 关于email发送的简单Demo
- ASP.net发送Email
- asp.net 发送email
- 用.net发送email
- ASP.net发送Email
- asp.net 发送Email
- .net 多线程发送Email
- ASP.net发送email
- .net 发送Email
- .NET 发送EMAIL邮件
- ASP.NET发送EMAIL
- asp.net发送Email
- 与低俗斗争到底
- 企业化Web 2.0 2009年八大预测
- 转贴自 : Varnish反向代理伺服器安裝配置
- 四管齐下搭建SOA治理框架
- Begin to blog
- 关于.net发送EMAIL的总结
- System.getProperty(String key)的用法
- STL 总结收藏
- Windows 和 Linux时间函数
- .net中把日期改成2009-01-01形式
- STL中的常用的vector,map,set,Sort用法收藏
- 根据表达式汇制其对应图象程序(含C#源码)
- 走近 STL
- VC下删除Excel工作表