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

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Palo Alto Networks Blog
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
NISL@THU
NISL@THU
L
Lohrmann on Cybersecurity
有赞技术团队
有赞技术团队
The GitHub Blog
The GitHub Blog
C
Cisco Blogs
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
Simon Willison's Weblog
Simon Willison's Weblog
T
Tenable Blog
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
WordPress大学
WordPress大学
月光博客
月光博客
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threat Research - Cisco Blogs
Cisco Talos Blog
Cisco Talos Blog
I
InfoQ
D
Darknet – Hacking Tools, Hacker News & Cyber Security
W
WeLiveSecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
U
Unit 42
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
Google DeepMind News
Google DeepMind News
Apple Machine Learning Research
Apple Machine Learning Research
Attack and Defense Labs
Attack and Defense Labs
罗磊的独立博客
T
The Exploit Database - CXSecurity.com
I
Intezer
GbyAI
GbyAI
Jina AI
Jina AI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Google Online Security Blog
Google Online Security Blog
Engineering at Meta
Engineering at Meta
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
小众软件
小众软件
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
Project Zero
Project Zero

博客园 - semye

input+select(multiple)实现下拉框输入值 简单的js分页脚本 - semye - 博客园 请问做个类似这样的网站多少钱 省份和城市 - semye - 博客园 客户端取用户控件中服务器控件的标识 VS2003调试很慢 enctype="multipart/form-data" SQL SERVER “数组参数” WEB水晶报表部署笔记 写程序解智力题,help!!! 低级错误是怎样“炼”成的? SQL语句区分大小写问题 发送邮件 - semye - 博客园 JS事件大全 WinForm动态添加控件及其事件 WinForm程序实现滚动字幕与背景音乐 公历转换为农历 简单水晶报表程序与安装部署文件制作 导数程序
群发邮件太慢了!
semye · 2007-07-26 · via 博客园 - semye

我用以下方法群发邮件,测试时发了600封,费时1小时,这个速度也太慢了,有没其它方法?

 1        delegate void dsend(); 
 2        private void Button1_Click(object sender, System.EventArgs e)
 3        {
 4            dsend ds = new dsend(Exec);
 5            ds.BeginInvoke(null,null);
 6        }

 7        private void Exec()
 8        {
 9            for(int i=0;i<2000;i++)
10            {
11                SentEmail(i);
12            }

13        }

14        
15        public void SentEmail(int i)
16        {
17            
18            MailMessage msg = new MailMessage();
19            msg.From = "semye@airprice.com";
20            msg.To = "semye@airprice.com";
21            msg.Subject = "测试邮件群发";
22            msg.Body = System.DateTime.Now.ToString();
23            msg.BodyFormat = MailFormat.Html;
24            msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate""1" ); 
25            msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",userName);
26            msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
27            msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", port);
28            //msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1");
29            SmtpMail.SmtpServer = "www.airprice.com";            
30            for(int j =0;;j++)
31            {
32                try
33                {
34                    SmtpMail.Send(msg);
35                    msg = null;                    
36                    WriteDaily(i,1,"",j);//写日志
37                    break;
38                }

39                catch(Exception ee)
40                {
41                    msg = null;
42                    if(j>1)
43                    {
44                        string a = ee.Message;
45                        WriteDaily(i,0,a,j);//写日志
46                        break;
47                    }

48                    else
49                    {
50                        Thread.Sleep(30000);
51                    }

52                
53                }

54            }

55        }

56        private void WriteDaily(int nb,int result,string error,int j)
57        {
58            string strconn = "server=.;uid=sa;pwd=;database=mytos";
59            string sql = "insert into SendMessage values("+nb+","+result+",'"+error+"','"+System.DateTime.Now+"',"+j+")";
60            SqlConnection conn = new  SqlConnection(strconn);
61            SqlCommand cmd  = new SqlCommand(sql,conn);
62            int i = 0;
63            try
64            {
65                conn.Open();
66                i=cmd.ExecuteNonQuery();
67                conn.Close();
68            }

69            catch(Exception ee)
70            {
71                string a = ee.Message;
72                conn.Close();
73            }

74        }