Asp.net 自动发送邮件的方法 (转)
2008-11-10 22:39
796 查看
今天有一个模块需要自动发送邮件的功能,就随便写了一个,记录一下作为积累。
一、首先需要配置web.config文件:
1<system.net>
2 <mailSettings>
3 <smtp from="Emailname">
4 <network host="smtp.163.com" userName="Emailname" password="Emailpassword"
5 port="25" defaultCredentials="false"/>
6 </smtp>
7 </mailSettings>
8</system.net>
二、然后编写发送邮件的函数:
1Asp.net 自动发送邮件的方法
2今天有一个模块需要自动发送邮件的功能,就随便写了一个,记录一下作为积累。
3
4
5一、首先需要配置web.config文件:
6
7
8<system.net>
9 <mailSettings>
10 <smtp from="Emailname">
11 <network host="smtp.163.com" userName="Emailname" password="Emailpassword"
12 port="25" defaultCredentials="false"/>
13 </smtp>
14 </mailSettings>
15</system.net>
16
17
18二、然后编写发送邮件的函数:
19
20
21public bool MySendMail(string mailto, string mailsubject, string mailbody, string mailFrom, ArrayList list)
31
61
62三、最后就是对函数的调用了:
63
64
65//自动发送邮件
66string mailSubject = "会员注册确认函";
67string mailBody = "正文内容。";
68string mailFrom = ConfigurationManager.AppSettings["SendMail"];
69ArrayList List = new ArrayList();
70List.Add(Server.MapPath(ConfigurationManager.AppSettings["SendMailText"]));
71if (MySendMail(this.txtEmail.Text, mailSubject, mailBody, mailFrom, List))
72else
77
83
三、最后就是对函数的调用了:
1//自动发送邮件
2string mailSubject = "会员注册确认函";
3string mailBody = "正文内容。";
4string mailFrom = ConfigurationManager.AppSettings["SendMail"];
5ArrayList List = new ArrayList();
6List.Add(Server.MapPath(ConfigurationManager.AppSettings["SendMailText"]));
7if (MySendMail(this.txtEmail.Text, mailSubject, mailBody, mailFrom, List))
8else
13{
14
15 //发送失败,进行相应处理
16 return;
17}
一、首先需要配置web.config文件:
1<system.net>
2 <mailSettings>
3 <smtp from="Emailname">
4 <network host="smtp.163.com" userName="Emailname" password="Emailpassword"
5 port="25" defaultCredentials="false"/>
6 </smtp>
7 </mailSettings>
8</system.net>
二、然后编写发送邮件的函数:
1Asp.net 自动发送邮件的方法
2今天有一个模块需要自动发送邮件的功能,就随便写了一个,记录一下作为积累。
3
4
5一、首先需要配置web.config文件:
6
7
8<system.net>
9 <mailSettings>
10 <smtp from="Emailname">
11 <network host="smtp.163.com" userName="Emailname" password="Emailpassword"
12 port="25" defaultCredentials="false"/>
13 </smtp>
14 </mailSettings>
15</system.net>
16
17
18二、然后编写发送邮件的函数:
19
20
21public bool MySendMail(string mailto, string mailsubject, string mailbody, string mailFrom, ArrayList list)
31
61
62三、最后就是对函数的调用了:
63
64
65//自动发送邮件
66string mailSubject = "会员注册确认函";
67string mailBody = "正文内容。";
68string mailFrom = ConfigurationManager.AppSettings["SendMail"];
69ArrayList List = new ArrayList();
70List.Add(Server.MapPath(ConfigurationManager.AppSettings["SendMailText"]));
71if (MySendMail(this.txtEmail.Text, mailSubject, mailBody, mailFrom, List))
72else
77
83
三、最后就是对函数的调用了:
1//自动发送邮件
2string mailSubject = "会员注册确认函";
3string mailBody = "正文内容。";
4string mailFrom = ConfigurationManager.AppSettings["SendMail"];
5ArrayList List = new ArrayList();
6List.Add(Server.MapPath(ConfigurationManager.AppSettings["SendMailText"]));
7if (MySendMail(this.txtEmail.Text, mailSubject, mailBody, mailFrom, List))
8else
13{
14
15 //发送失败,进行相应处理
16 return;
17}
相关文章推荐
- Asp.net 自动发送邮件的方法
- Asp.net 自动发送邮件的方法
- Asp.net 自动发送邮件的方法
- Asp.net 自动发送邮件的方法
- Asp.net 自动发送邮件的方法
- Asp.Net定时发送邮件方法(使用线程的方法)
- .NET进阶学习之使用ASP.NET两种发送邮件的方法
- asp.net代码怎么自动发送邮件?
- 在Asp.Net中使用SmtpMail发送邮件的方法
- asp.net代码发送邮件方法(二)
- 在ASP.NET中使用SMTPMail发送邮件的方法
- ASP.NET 定时发送邮件 实现方法(包括确认邮件)
- 详解Asp.Net定时发送邮件方法
- asp.net最简单的邮件自动发送
- asp.net一个实现发送邮件的方法
- Asp.net发送邮件的两种方法
- ASP.NET 中点击按钮时邮件自动发送功能实例
- Asp.net发送邮件的两种方法
- 【转】【Asp.Net】Asp.net发送邮件的两种方法小结