惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 热门话题
Stack Overflow Blog
Stack Overflow Blog
B
Blog
WordPress大学
WordPress大学
Project Zero
Project Zero
P
Palo Alto Networks Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
T
Tailwind CSS Blog
Forbes - Security
Forbes - Security
F
Full Disclosure
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
O
OpenAI News
Spread Privacy
Spread Privacy
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
IT之家
IT之家
U
Unit 42
腾讯CDC
S
Security Affairs
C
Cisco Blogs
Schneier on Security
Schneier on Security
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss

博客园 - phcis

c# 全角(SBC)和半角(DBC)相互转换函数 用HttpWebRequest做POST请求时返回Http 417 错误解决方法 使用webbroswer的一点技巧记录 计算字符串相似度及寻找最相似字符串的代码 asp.net中js返回false时阻止form提交的方法 【转】DIV+CSS 让文字居中于背景图 sql 语句实现分页 【转】C#产生随机字符的两段代码 【转】datagridview的checkbox列,当修改checkbox状态时实时获得其准确状态值 c# 读取excel的一系列问题 - phcis - 博客园 由于使用“优易U盘加密软件”导致电脑无法关机/蓝屏等解决方法 批量删除数据库中所有表的记录(清空数据库) C# HttpRequest基础连接已经关闭: 接收时发生意外错误 GridView 动态绑定数据,包括2个或者多个值 - phcis - 博客园 近期动向 使用ajax导致滚动条复位的解决方法 AT编程常见问题与错误代码的意义 使用AutocompleteExtender无效或者没反应的原因记录 使用 DateTimePicker 控件显示和选择时间
c# 发送email,正文支持html格式,包含附件
phcis · 2010-03-02 · via 博客园 - phcis

 1  string v_smtpAddress ="smtp.xxx.com";//smtp地址,如smtp.163.com
 2         string v_sendMailUserName = "userName";//发送邮件使用的用户名
 3         string v_sendMailPassword = "userPwd";//发送邮件使用的密码
 4         string v_sendMailAddress ="phcis@163.com";//发送邮件的mail地址
 5         string v_receiveMailAddress ="phcis@163.com";//接收邮件的mail地址
 6         string v_mailSubject = "邮件主题";//邮件主题
 7 
 8 
 9         SmtpClient smtp = new SmtpClient(v_smtpAddress);
10         smtp.Credentials = new System.Net.NetworkCredential(v_sendMailUserName, v_sendMailPassword);
11         MailMessage mes = new MailMessage();
12 
13         mes.From = new MailAddress(v_sendMailAddress);
14         mes.To.Add(v_receiveMailAddress);
15 
16         mes.Subject = v_mailSubject;
17         mes.Body = TextArea1.Value;
18         mes.IsBodyHtml = true;//使用是否html格式
19 
20          //增加附件
21         System.Net.Mail.Attachment mailAttach_1 = new  Attachment(@"d:\b.txt");
22         mes.Attachments.Add(mailAttach_1);
23         
24         smtp.Send(mes);
25         mailAttach_1.Dispose();//释放由附件占用的资源

posted @ 2010-03-02 15:47  phcis  阅读(1515)  评论()    收藏  举报