All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
利用Atlas库为Web页面加入鼠标拖放功能_.net资料_编程技术
入门实例:PHP制作的网站意见在线反馈表_php资料_编程技术
PHP教程实例:用PHP打造动态聊天室系统_[PHP教程]
Asp.Net2.0数据库基本操作方法学习_[Asp.Net教程]
SQL,Server,2008,R2十大新特性解析_mssql学习_编程技术
避免SQL Server和Access的空值冲突_[SQL Server教程]
利用GridView显示主细表并添加删除、打开、关闭功能(续)_[Asp.Net教程]
SQL语言快速入门之一_mssql学习_编程技术
asp.net生成静态页面_.net资料_编程技术
javascript实例:Select的OnChange()事件_JavaScript技术_编程技术
Reading number is top 10 pictures
YangYuYing and ZhengShaoQiu dance on the generous come interest dye-in-the-wood
The little woman's bright wire1
NeedWallpaper12
人美胸美腿更美2
Summer is most suitable for young people to travel in China6
photos of ashlynn brooke(ashlynn brooke的美图)
美女挤公交
西游四格漫画(四)
Summer is most suitable for young people to travel in China7
全球清廉国家排行
Download software ranking
Unix video tutorial10
Tram sex maniac 2 (H) rar bag4
jdk1.6 for windows
Boxer's Top ten classic battle6
好色的外科大夫
中国结婚习俗实录
Tram sex maniac 2 (H) rar bag3
Unix video tutorial17
linux高级编程
美女游泳记
归海一刀 published in(发表于) 2014/1/30 0:58:34 Edit(编辑)
ASP.NET2.0邮件群发_[Asp.Net教程]

ASP.NET2.0邮件群发_[Asp.Net教程]

ASP.NET2.0邮件群发_[Asp.Net教程]

邮件群发界面如下:




首先添加命名空间
using System.Net.Mail;
using System.Data.SqlClient;

代码其实很简单,当然我这个功能比较简单
就是一个单击事件


protected void btn_send_Click(object sender, EventArgs e)
{
MailMessage message = new MailMessage();
//获取发送者地址
message.From = new MailAddress(tbx_address.Text.Trim());
//获取主题
message.Subject = tbx_subject.Text.Trim();
//获取发送邮件主题
message.Body = we_content.Text.Trim();
message.IsBodyHtml = true;
//设置数据库链接
SqlConnection conn = new SqlConnection(getstring());
conn.Open();
//数据查询用的是存储过程
SqlCommand cmd = new SqlCommand("SelectEmail", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter dutyparameter = cmd.Parameters.Add("@MemberDuty", SqlDbType.NVarChar, 20);
dutyparameter.Value = ddl_selectemail.SelectedValue;
SqlDataReader dr = cmd.ExecuteReader();
//执行查询获得要发往的邮件地址
while (dr.Read())
{
message.To.Add(dr["MemberEmail"].ToString());

}
conn.Close();
SmtpClient client = new SmtpClient();
client.Send(message);
lbl_info.Visible = true;
lbl_info.Text = "发送成功";

}


另外在web。config设置发送邮件的远程服务器连接


代码如下










来源:cnblogs







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.