文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 国产软件 | 国外软件 | 汉化补丁 | 设为首页 | 加入收藏
业界资讯 | 图形图像 | 操作系统 | 网络冲浪 | 工具软件 | 办公软件 | 媒体动画 | 精文荟萃 | 认证考试 | 网站建设 | 技术开发 | 专栏
当前位置:abcdown网络学院网络编程Asp.Net.net发送邮件的一些技巧
精品广告
推荐TOP10
·asp.net创建文件夹的IO类的问题
·ASP.NET 2.0 多文件上传小经验
·asp.net常用代码
·Asp.net cache 简述
·技巧实例:ASP.NET生成静态页面实现方法
·ASP.NET、JSP及PHP之间的抉择
·.net基础知识错误注意二十二点知识
·asp.net2.0学习历程 菜鸟到中级程序员的飞跃
·.NET基础知识-什么是.NET
·初学C#+ASP.NET+Oracle时积累的备忘点滴
阅读TOP10
·使用ASP.NET2.0的ReportViewer查看RDLC报表
·打造一个通用ASP.NET数据分页控件
·asp.net结合html,javascript实现无刷新跨域数据提交
·Asp.Net中使用水晶报表
·ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!
·ASP.NET 2.0 多文件上传小经验
·Asp.net cache 简述
·用http代理下载sourceforge的cvs仓库[原理+C#代码]
·asp.net常用代码
·利用.net反射动态调用指定程序集的中的方法

.net发送邮件的一些技巧

日期:2007年1月17日 作者: 查看:[大字体 中字体 小字体]


用System.Web.Mail发送邮件,适用于.net1.1,.net2.0请用System.Net.Mail

先引用System.Web
1,发送简单邮件
[ C# ]
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
SmtpMail.SmtpServer = "localhost"; //your real server goes here
SmtpMail.Send( mail );

[ VB.NET ]
Dim mail As New MailMessage()
mail.To = "me@mycompany.com"
mail.From = "you@yourcompany.com"
mail.Subject = "this is a test email."
mail.Body = "this is my test email body"
SmtpMail.SmtpServer = "localhost" 'your real server goes here
SmtpMail.Send(mail)

这里的smtpserver只能是那些不需要验证的smtp服务器,像126,sina,yahoo等等的邮箱,都需要验证,所以不能用。用这些邮箱发信后面会讲到


2,发送Html邮件
[ C# ]
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.BodyFormat = MailFormat.Html;
mail.Body = "this is my test email body.<br><b>this part is in bold</b>";
SmtpMail.SmtpServer = "localhost"; //your real server goes here
SmtpMail.Send( mail );


[ VB.NET ]
Dim mail As New MailMessage()
mail.To = "me@mycompany.com"
mail.From = "you@yourcompany.com"
mail.Subject = "this is a test email."
mail.BodyFormat = MailFormat.Html
mail.Body = "this is my test email body.<br><b>this part is in bold</b>"
SmtpMail.SmtpServer = "localhost" 'your real server goes here
SmtpMail.Send(mail)

3,发送附件
[ C# ]
MailMessage mail = new MailMessage();

[1] [2] [3] [4] [5] 下一页 

上一篇:SQL Server 2005 Reporting Services的一个bug及其解决方法

下一篇:C# 参考之访问关键字:base、this


相关软件: 相关文章:
·《拳皇2002》隐藏超杀出招表 - 技巧心得
·Photoshop十余种漂亮照片边框简单制作技巧
·Excel排序技巧两则
·传授追女孩之技巧之新手篇
·巧用Photoshop为透明玻璃杯抠图
·婚纱照片抠图与背景处理合成技巧
·《暗黑破坏神II》1.10惊天大BUG - 技巧心得

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.abcdown.net
首页 | 本站声明 | 下载帮助 | 发布软件 |
中文版权所有:ABC学院 浙ICP备05000717号