QQ群发邮箱程序
这一段时间,QQ邮箱每天都收到一堆垃圾邮件,发件人肯定是通过软件进行群发的。但是群发的邮件一般都被TX标记垃圾邮件。
我在想:
1.别人是怎么想知道我这个QQ邮箱的?是随机发送还是通过TX服务器数据库验证取得的?
2.如何群发QQ邮件,不别TX标识为垃圾邮件呢?
邮件发送一般都是基于SMTP协议。对于第一个问题,还好解决,第二问题好像比较复杂,暂且放一放。
今天首先简单解决实现第一个问题。
如果是随机发送,简单但发送的邮件非常盲目;如果是通TX数据库的,TX好像没有公开API,如何验证?我想了半天,估计目前大部分QQ邮件群发工具应该都是随机生成QQ号,然后组成QQ邮箱,然后通过配置SMTP发送邮件。
那么程序做起来非常简单,没有任何技术含量。
这里我暂时把我想到的贴在这里,仅供新手参考,大虾们就不要看了。
程序主要代码:
View Code
1 /// <summary>
2 /// 发送邮件按钮
3 /// </summary>
4 /// <param name="sender"></param>
5 /// <param name="e"></param>
6 private void btnSend_Click(object sender, EventArgs e)
7 {
8 int start = 0;
9 int end = 0;
10 int count = 0;
11 string port = txtPort.Text;
12 string smtp = txtSmtp.Text;
13 string mailForm = txtSend.Text;
14 string mailPwd = txtPwd.Text;
15 string title = txtTitle.Text;
16 string content = rtxtContent.Text;
17 if (string.IsNullOrEmpty(txtCount.Text))
18 {
19 MessageBox.Show("目标邮箱个数不能为空", "系统提示");
20 txtCount.Focus();
21 return;
22 }
23 if (string.IsNullOrEmpty(txtStart.Text))
24 {
25 MessageBox.Show("起始号码不能为空", "系统提示");
26 txtStart.Focus();
27 return;
28 }
29 if (string.IsNullOrEmpty(txtEnd.Text))
30 {
31 MessageBox.Show("截止号码不能为空", "系统提示");
32 txtEnd.Focus();
33 return;
34 }
35 if (string.IsNullOrEmpty(port))
36 {
37 MessageBox.Show("端口号不能为空", "系统提示");
38 txtPort.Focus();
39 return;
40 }
41 if (string.IsNullOrEmpty(smtp))
42 {
43 MessageBox.Show("SMTP不能为空", "系统提示");
44 txtSmtp.Focus();
45 return;
46 }
47 if (string.IsNullOrEmpty(mailForm))
48 {
49 MessageBox.Show("发件人邮箱不能为空", "系统提示");
50 txtSend.Focus();
51 return;
52 }
53 if (string.IsNullOrEmpty(mailPwd))
54 {
55 MessageBox.Show("发件人邮箱密码不能为空", "系统提示");
56 txtPwd.Focus();
57 return;
58 }
59 if (string.IsNullOrEmpty(title))
60 {
61 MessageBox.Show("邮件标题不能为空", "系统提示");
62 txtTitle.Focus();
63 return;
64 }
65
66 if (!DY.Network.Email.IsEmail(mailForm))
67 {
68 MessageBox.Show("发件人邮箱格式不正确", "系统提示");
69 txtSend.Focus();
70 return;
71 }
72 Cursor.Current = Cursors.WaitCursor;
73 btnSend.Enabled = false;
74 start = Convert.ToInt32(txtStart.Text);
75 end = Convert.ToInt32(txtEnd.Text);
76 count = Convert.ToInt32(txtCount.Text);
77 ArrayList arry = new ArrayList();
78 Random ran = new Random();
79 string temp = string.Empty;
80 for (int i = 0; i < count; i++)
81 {
82 temp = ran.Next(start, end).ToString() + "@qq.com";
83 arry.Add(temp);
84 }
85 arry.TrimToSize();
86 string[] retArry = new string[] { "chyoki@126.com" };
87 retArry = (string[])(arry.ToArray(typeof(string)));
88 try
89 {
90 DY.Network.Email email = new DY.Network.Email();
91 email.Sender = title;
92 email.From = mailForm;
93 email.Pwd = mailPwd;
94 email.Port = Convert.ToInt32(port);
95 email.IsSSL = chrbSsl.Checked;
96 email.SMTP = smtp;
97 email.Send(retArry, title, content);
98 MessageBox.Show("邮件群发成功", "系统提示");
99 }
100 catch (Exception ex)
101 {
102 MessageBox.Show(ex.Message.ToString(), "系统提示");
103 }
104 btnSend.Enabled = true;
105 Cursor.Current = Cursors.Default;
106 }
2 /// 发送邮件按钮
3 /// </summary>
4 /// <param name="sender"></param>
5 /// <param name="e"></param>
6 private void btnSend_Click(object sender, EventArgs e)
7 {
8 int start = 0;
9 int end = 0;
10 int count = 0;
11 string port = txtPort.Text;
12 string smtp = txtSmtp.Text;
13 string mailForm = txtSend.Text;
14 string mailPwd = txtPwd.Text;
15 string title = txtTitle.Text;
16 string content = rtxtContent.Text;
17 if (string.IsNullOrEmpty(txtCount.Text))
18 {
19 MessageBox.Show("目标邮箱个数不能为空", "系统提示");
20 txtCount.Focus();
21 return;
22 }
23 if (string.IsNullOrEmpty(txtStart.Text))
24 {
25 MessageBox.Show("起始号码不能为空", "系统提示");
26 txtStart.Focus();
27 return;
28 }
29 if (string.IsNullOrEmpty(txtEnd.Text))
30 {
31 MessageBox.Show("截止号码不能为空", "系统提示");
32 txtEnd.Focus();
33 return;
34 }
35 if (string.IsNullOrEmpty(port))
36 {
37 MessageBox.Show("端口号不能为空", "系统提示");
38 txtPort.Focus();
39 return;
40 }
41 if (string.IsNullOrEmpty(smtp))
42 {
43 MessageBox.Show("SMTP不能为空", "系统提示");
44 txtSmtp.Focus();
45 return;
46 }
47 if (string.IsNullOrEmpty(mailForm))
48 {
49 MessageBox.Show("发件人邮箱不能为空", "系统提示");
50 txtSend.Focus();
51 return;
52 }
53 if (string.IsNullOrEmpty(mailPwd))
54 {
55 MessageBox.Show("发件人邮箱密码不能为空", "系统提示");
56 txtPwd.Focus();
57 return;
58 }
59 if (string.IsNullOrEmpty(title))
60 {
61 MessageBox.Show("邮件标题不能为空", "系统提示");
62 txtTitle.Focus();
63 return;
64 }
65
66 if (!DY.Network.Email.IsEmail(mailForm))
67 {
68 MessageBox.Show("发件人邮箱格式不正确", "系统提示");
69 txtSend.Focus();
70 return;
71 }
72 Cursor.Current = Cursors.WaitCursor;
73 btnSend.Enabled = false;
74 start = Convert.ToInt32(txtStart.Text);
75 end = Convert.ToInt32(txtEnd.Text);
76 count = Convert.ToInt32(txtCount.Text);
77 ArrayList arry = new ArrayList();
78 Random ran = new Random();
79 string temp = string.Empty;
80 for (int i = 0; i < count; i++)
81 {
82 temp = ran.Next(start, end).ToString() + "@qq.com";
83 arry.Add(temp);
84 }
85 arry.TrimToSize();
86 string[] retArry = new string[] { "chyoki@126.com" };
87 retArry = (string[])(arry.ToArray(typeof(string)));
88 try
89 {
90 DY.Network.Email email = new DY.Network.Email();
91 email.Sender = title;
92 email.From = mailForm;
93 email.Pwd = mailPwd;
94 email.Port = Convert.ToInt32(port);
95 email.IsSSL = chrbSsl.Checked;
96 email.SMTP = smtp;
97 email.Send(retArry, title, content);
98 MessageBox.Show("邮件群发成功", "系统提示");
99 }
100 catch (Exception ex)
101 {
102 MessageBox.Show(ex.Message.ToString(), "系统提示");
103 }
104 btnSend.Enabled = true;
105 Cursor.Current = Cursors.Default;
106 }
程序源代码:
转载请保留 http://www.cnblogs.com/cgli/archive/2011/05/02/2034651.html 原文地址
本文来自博客园,作者:陈国利,转载请注明原文链接:https://www.cnblogs.com/cgli/archive/2011/05/02/2034651.html
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。
如果您觉得文章对您有帮助,可以点击文章右下角"推荐"或关注本人博客。您的鼓励是作者坚持原创和持续写作的最大动力!