-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path网页扫邮箱器.frm
300 lines (286 loc) · 8.61 KB
/
网页扫邮箱器.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
VERSION 5.00
Begin VB.Form Form1
Caption = "发邮箱神器(By:吸金大法之001 QQ:2523198627)"
ClientHeight = 6960
ClientLeft = 120
ClientTop = 450
ClientWidth = 12855
LinkTopic = "Form1"
ScaleHeight = 6960
ScaleWidth = 12855
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "邮箱配置"
Height = 2055
Left = 120
TabIndex = 12
Top = 120
Width = 2895
Begin VB.CheckBox chkLocked
Caption = "锁定设置"
Height = 375
Left = 120
TabIndex = 17
Top = 1600
Width = 2655
End
Begin VB.TextBox txtPass
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 120
PasswordChar = "*"
TabIndex = 16
Top = 1200
Width = 2655
End
Begin VB.TextBox txtEmail
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 13
Top = 480
Width = 2655
End
Begin VB.Label Label7
Caption = "密码"
Height = 255
Left = 120
TabIndex = 15
Top = 960
Width = 375
End
Begin VB.Label Label6
Caption = "邮箱"
Height = 255
Left = 120
TabIndex = 14
Top = 240
Width = 495
End
End
Begin VB.TextBox Text1
Height = 375
Left = 600
TabIndex = 11
Top = 2280
Width = 2655
End
Begin VB.TextBox txtAttach
Height = 375
Left = 7320
TabIndex = 9
Top = 5760
Width = 5415
End
Begin VB.TextBox txtTitle
Height = 375
Left = 7320
TabIndex = 6
Top = 600
Width = 5415
End
Begin VB.TextBox txtContent
Height = 4455
Left = 7320
MultiLine = -1 'True
TabIndex = 4
Top = 1200
Width = 5415
End
Begin VB.TextBox txtLog
Height = 4095
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 2760
Width = 6495
End
Begin VB.CommandButton btnGetAndSend
Caption = "一键获取邮箱并发送"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 7320
TabIndex = 1
Top = 6240
Width = 5415
End
Begin VB.TextBox txtUrl
Height = 375
Left = 7320
TabIndex = 0
Top = 120
Width = 5415
End
Begin VB.Label Label5
Caption = "附件"
Height = 255
Left = 6840
TabIndex = 10
Top = 5835
Visible = 0 'False
Width = 375
End
Begin VB.Label Label4
Caption = "邮件内容"
Height = 255
Left = 6480
TabIndex = 8
Top = 1200
Width = 735
End
Begin VB.Label Label3
Caption = "邮件标题"
Height = 255
Left = 6480
TabIndex = 7
Top = 720
Width = 735
End
Begin VB.Label Label2
Caption = "日志"
Height = 255
Left = 120
TabIndex = 5
Top = 2400
Width = 495
End
Begin VB.Label Label1
Caption = "有邮箱的网址"
Height = 255
Left = 6120
TabIndex = 3
Top = 240
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private web As New WebCode
Private mail As New CEmail
Private Sub chkLocked_Click()
If chkLocked.Value = 1 Then
'本次勾选了
Else
'本次取消勾选了
End If
End Sub
Private Sub btnGetAndSend_Click()
On Error Resume Next
Dim pageHtml As String
Dim re As RegExp
Dim mh As Match
Dim mhs As MatchCollection
Dim retstr As String
Dim r() As String
Dim i As Integer, OkCount As Integer
'检测地址是否为空
If txtUrl.Text = "" Then
MsgBox "网址为空", vbCritical, "发送大卫提示"
Exit Sub
End If
If txtEmail.Text = "" Then
MsgBox "发件邮箱为空", vbCritical, "发送大卫提示"
Exit Sub
End If
If txtPass.Text = "" Then
MsgBox "发件密码为空", vbCritical, "发送大卫提示"
Exit Sub
End If
pageHtml = web.GetHTMLCode(txtUrl.Text)
'用正则函数检测pageHtml中所有符合邮箱格式的字符串
retstr = ""
Set re = New RegExp
re.IgnoreCase = False
re.Global = True
re.Pattern = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Set mhs = re.Execute(pageHtml)
For Each mh In mhs '' Iterate Matches collection.
retstr = retstr & mh.Value & ";" & vbCrLf
Next
'支持发送vip.qq.com的格式
mail.SetUser txtEmail.Text, txtPass.Text
mail.SetSMTP "smtp.163.com"
If txtAttach.Text <> "" Then
If Dir(txtAttach.Text) <> "" Then
mail.AddFile txtAttach.Text
End If
End If
r = Split(retstr, vbCrLf)
txtLog.Text = Time & " - 启动任务"
For i = 0 To UBound(r)
DoEvents
If Len(r(i)) <= 1 Then
DoEvents
txtLog.Text = txtLog.Text & vbCrLf & Time & " - [" & i + 1 & "/" & UBound(r) + 1 & "]空数据"
DoEvents
Else
mail.SendMail txtEmail.Text, r(i), txtTitle.Text, txtContent.Text
If Err.Number <> 0 Then
DoEvents
txtLog.Text = txtLog.Text & vbCrLf & Time & " - [" & i + 1 & "/" & UBound(r) + 1 & "]" & Err.Description
DoEvents
Err.Clear
Else
DoEvents
txtLog.Text = txtLog.Text & vbCrLf & Time & " - [" & i + 1 & "/" & UBound(r) + 1 & "]" & "[" & r(i) & "]发送成功"
DoEvents
OkCount = OkCount + 1
Text1.Text = "成功 " & OkCount & " 个"
DoEvents
End If
End If
txtLog.SelStart = Len(txtLog.Text)
Next i
txtLog.Text = txtLog.Text & vbCrLf & Time & " - 任务完成"
txtLog.SelStart = Len(txtLog.Text)
End Sub
Private Sub SaveSet(ByVal Key As String, ByVal Value As String)
SaveSetting "vb6-tieba-emailtoall", "mailconfig", Key, Value
End Sub
Private Function GetSet(ByVal Key As String) As String
GetSet = GetSetting("vb6-tieba-emailtoall", "mailconfig", Key)
End Function
Private Sub Form_Load()
txtEmail.Text = GetSet("mail")
txtPass.Text = GetSet("pass")
txtUrl.Text = GetSet("url")
txtTitle.Text = GetSet("title")
txtContent.Text = GetSet("content")
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSet "mail", txtEmail.Text
SaveSet "pass", txtPass.Text
SaveSet "url", txtUrl.Text
SaveSet "title", txtTitle.Text
SaveSet "content", txtContent.Text
End
End Sub