编译后的exe文件,方便大家直接使用 下载地址 https://www.jb51.net/softs/44627.html
配置文件内容如下:
复制代码 代码如下:
配置文件代码
[收件人]
收件地址=
邮件标题=
[发送人]
邮箱=
密码=
核心代码:
复制代码 代码如下:
#region AutoIt3Wrapper 预编译参数(常用参数)
#AutoIt3Wrapper_Icon=D:\ico\3444\2222.ico ;图标,支持EXE,DLL,ICO
#AutoIt3Wrapper_OutFile=GetIp_Sendmail.exe ;输出文件名
#AutoIt3Wrapper_OutFile_Type=exe ;文件类型
#AutoIt3Wrapper_Compression=4 ;压缩等级
#AutoIt3Wrapper_UseUpx=y ;使用压缩
#AutoIt3Wrapper_Res_Comment= ;注释
#AutoIt3Wrapper_Res_Description= ;详细信息
#AutoIt3Wrapper_Res_Fileversion= ;文件版本
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p ;自动更新版本
#AutoIt3Wrapper_Res_LegalCopyright= ;版权
#AutoIt3Wrapper_Change2CUI=N ;修改输出的程序为CUI(控制台程序)
;#AutoItAutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% ;自定义资源段
;#AutoIt3Wrapper_Run_Tidy= ;脚本整理
;#AutoIt3Wrapper_Run_Obfuscator= ;代码迷惑
;#AutoIt3Wrapper_Run_AU3Check= ;语法检查
;#AutoIt3Wrapper_Run_Before= ;运行前
;#AutoIt3Wrapper_Run_After= ;运行后
#endregion AutoIt3Wrapper 预编译参数(常用参数)
#include <file.au3>
#include <Inet.au3>
#include <Date.au3>
;禁止重复运行。
$g_szVersion = '获取外网IP并发送到指定邮箱'
If WinExists($g_szVersion) Then
Exit
EndIf
AutoItWinSetTitle($g_szVersion)
;托盘事件
Opt("TrayOnEventMode", 1);托盘事件通知
Opt("TrayMenuMode", 1) ; 默认菜单项目 (脚本暂停中/退出)(Script Paused/Exit) 将不会显示.
TrayCreateItem("发送")
TrayItemSetOnEvent(-1,'_Sendmail')
$exititem = TrayCreateItem("退出程序")
TrayItemSetOnEvent($exititem, "_Exit")
TraySetClick(16) ; 只有单击第二个鼠标按键(默认右键)才会显示托盘菜单
TraySetToolTip('获取外网IP并发送到指定邮箱')
TraySetState()
Global $testIp
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$s_ToAddress = IniRead(@ScriptDir & "\Config.ini", '收件人', '收件地址', '-1');收件人地址
$s_Subject = IniRead(@ScriptDir & "\Config.ini", '收件人', '邮件标题', '-1');邮件标题
TrayTip("准备就绪", "收件人地址:" & $s_ToAddress _
& @CRLF & "邮件标题:" & $s_Subject, 5, 1)
_Sendmail();发送邮件
AdlibRegister('_ReduceMemory', 1000 * 10);10秒整理一次内存
AdlibRegister('_Sendmail',1000*15)
While 1
Sleep(3000)
WEnd
Func _Exit()
Exit
EndFunc ;==>_Exit
;发送邮件====================================================================
Func _Sendmail()
$s_SmtpServer = "smtp.163.com" ;SMTP服务器
$s_FromName = "bbs.wglm.net" ;邮件发送人
$s_FromAddress = IniRead(@ScriptDir & "\Config.ini", '发送人', '邮箱', '-1') ;邮件发送者地址
$s_ToAddress = IniRead(@ScriptDir & "\Config.ini", '收件人', '收件地址', '-1');"19377708@qq.com" ;收件人地址
$s_Subject = IniRead(@ScriptDir & "\Config.ini", '收件人', '邮件标题', '-1');"AU3邮件发送测试" ;邮件标题
Do
$Getip = _GetIP();外网IP
Sleep(300)
TrayTip("提示", '正在获取外网IP', 5, 1)
Until $Getip <> -1
If $testIp = $Getip Then
TrayTip("提示", '外网IP与上次发送的相同' & @CRLF & '程序将不重复发送.', 5, 1)
Return ;MsgBox(0,'',$Getip)
EndIf
$testIp = $Getip
$as_Body = "外网IP:" & $Getip & @CRLF & "发送时间:" & _NowDate() & " " & _NowTime() ;邮件正文;获取外网IP
$s_AttachFiles = "" ;附件地址
$s_CcAddress = "" ;抄送地址
$s_BccAddress = "" ;密件抄送地址
$s_Username = IniRead(@ScriptDir & "\Config.ini", '发送人', '邮箱', '-1') ;用户名
$s_Password = IniRead(@ScriptDir & "\Config.ini", '发送人', '密码', '-1') ;密码
$IPPort = 25 ;发送端口,Gmail使用的发送端口为465
$ssl = 0
$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
If @error Then
_FileWriteLog(@ScriptDir & "\MailSendlog.log", "邮件发送失败 错误代码:" & @error & " 描述:" & $rc)
TrayTip("邮件发送失败", "错误代码:" & @error _
& @CRLF & "描述:" & $rc, 5, 1)
Else
_FileWriteLog(@ScriptDir & "\MailSendlog.log", "邮件发送成功 收件人地址: " & $s_ToAddress & " 邮件标题: " & $s_Subject & " 邮件正文:" & $as_Body)
TrayTip("邮件发送成功", "收件人地址: " & $s_ToAddress _
& @CRLF & "邮件标题: " & $s_Subject _
& @CRLF & "邮件正文:" & $as_Body, 5, 1)
EndIf
EndFunc ;==>_Sendmail
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
$objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ",");文件分格符
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
If FileExists($S_Files2Attach[$x]) Then
$objEmail.AddAttachment($S_Files2Attach[$x])
Else
$i_Error_desciption = $i_Error_desciption & @LF & 'File not found to attach: ' & $S_Files2Attach[$x]
SetError(1)
Return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
If $ssl Then
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet[1]
EndIf
EndFunc ;==>_INetSmtpMailCom
; Com Error Handler
Func MyErrFunc()
$HexHexNumber = Hex($oMyError.number, 8)
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>MyErrFunc
;发送邮件结束====================================================================
;整理内存
Func _ReduceMemory()
$I_PID = @AutoItPID
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $I_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory
配置文件内容如下:
复制代码 代码如下:
配置文件代码
[收件人]
收件地址=
邮件标题=
[发送人]
邮箱=
密码=
核心代码:
复制代码 代码如下:
#region AutoIt3Wrapper 预编译参数(常用参数)
#AutoIt3Wrapper_Icon=D:\ico\3444\2222.ico ;图标,支持EXE,DLL,ICO
#AutoIt3Wrapper_OutFile=GetIp_Sendmail.exe ;输出文件名
#AutoIt3Wrapper_OutFile_Type=exe ;文件类型
#AutoIt3Wrapper_Compression=4 ;压缩等级
#AutoIt3Wrapper_UseUpx=y ;使用压缩
#AutoIt3Wrapper_Res_Comment= ;注释
#AutoIt3Wrapper_Res_Description= ;详细信息
#AutoIt3Wrapper_Res_Fileversion= ;文件版本
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p ;自动更新版本
#AutoIt3Wrapper_Res_LegalCopyright= ;版权
#AutoIt3Wrapper_Change2CUI=N ;修改输出的程序为CUI(控制台程序)
;#AutoItAutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% ;自定义资源段
;#AutoIt3Wrapper_Run_Tidy= ;脚本整理
;#AutoIt3Wrapper_Run_Obfuscator= ;代码迷惑
;#AutoIt3Wrapper_Run_AU3Check= ;语法检查
;#AutoIt3Wrapper_Run_Before= ;运行前
;#AutoIt3Wrapper_Run_After= ;运行后
#endregion AutoIt3Wrapper 预编译参数(常用参数)
#include <file.au3>
#include <Inet.au3>
#include <Date.au3>
;禁止重复运行。
$g_szVersion = '获取外网IP并发送到指定邮箱'
If WinExists($g_szVersion) Then
Exit
EndIf
AutoItWinSetTitle($g_szVersion)
;托盘事件
Opt("TrayOnEventMode", 1);托盘事件通知
Opt("TrayMenuMode", 1) ; 默认菜单项目 (脚本暂停中/退出)(Script Paused/Exit) 将不会显示.
TrayCreateItem("发送")
TrayItemSetOnEvent(-1,'_Sendmail')
$exititem = TrayCreateItem("退出程序")
TrayItemSetOnEvent($exititem, "_Exit")
TraySetClick(16) ; 只有单击第二个鼠标按键(默认右键)才会显示托盘菜单
TraySetToolTip('获取外网IP并发送到指定邮箱')
TraySetState()
Global $testIp
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$s_ToAddress = IniRead(@ScriptDir & "\Config.ini", '收件人', '收件地址', '-1');收件人地址
$s_Subject = IniRead(@ScriptDir & "\Config.ini", '收件人', '邮件标题', '-1');邮件标题
TrayTip("准备就绪", "收件人地址:" & $s_ToAddress _
& @CRLF & "邮件标题:" & $s_Subject, 5, 1)
_Sendmail();发送邮件
AdlibRegister('_ReduceMemory', 1000 * 10);10秒整理一次内存
AdlibRegister('_Sendmail',1000*15)
While 1
Sleep(3000)
WEnd
Func _Exit()
Exit
EndFunc ;==>_Exit
;发送邮件====================================================================
Func _Sendmail()
$s_SmtpServer = "smtp.163.com" ;SMTP服务器
$s_FromName = "bbs.wglm.net" ;邮件发送人
$s_FromAddress = IniRead(@ScriptDir & "\Config.ini", '发送人', '邮箱', '-1') ;邮件发送者地址
$s_ToAddress = IniRead(@ScriptDir & "\Config.ini", '收件人', '收件地址', '-1');"19377708@qq.com" ;收件人地址
$s_Subject = IniRead(@ScriptDir & "\Config.ini", '收件人', '邮件标题', '-1');"AU3邮件发送测试" ;邮件标题
Do
$Getip = _GetIP();外网IP
Sleep(300)
TrayTip("提示", '正在获取外网IP', 5, 1)
Until $Getip <> -1
If $testIp = $Getip Then
TrayTip("提示", '外网IP与上次发送的相同' & @CRLF & '程序将不重复发送.', 5, 1)
Return ;MsgBox(0,'',$Getip)
EndIf
$testIp = $Getip
$as_Body = "外网IP:" & $Getip & @CRLF & "发送时间:" & _NowDate() & " " & _NowTime() ;邮件正文;获取外网IP
$s_AttachFiles = "" ;附件地址
$s_CcAddress = "" ;抄送地址
$s_BccAddress = "" ;密件抄送地址
$s_Username = IniRead(@ScriptDir & "\Config.ini", '发送人', '邮箱', '-1') ;用户名
$s_Password = IniRead(@ScriptDir & "\Config.ini", '发送人', '密码', '-1') ;密码
$IPPort = 25 ;发送端口,Gmail使用的发送端口为465
$ssl = 0
$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
If @error Then
_FileWriteLog(@ScriptDir & "\MailSendlog.log", "邮件发送失败 错误代码:" & @error & " 描述:" & $rc)
TrayTip("邮件发送失败", "错误代码:" & @error _
& @CRLF & "描述:" & $rc, 5, 1)
Else
_FileWriteLog(@ScriptDir & "\MailSendlog.log", "邮件发送成功 收件人地址: " & $s_ToAddress & " 邮件标题: " & $s_Subject & " 邮件正文:" & $as_Body)
TrayTip("邮件发送成功", "收件人地址: " & $s_ToAddress _
& @CRLF & "邮件标题: " & $s_Subject _
& @CRLF & "邮件正文:" & $as_Body, 5, 1)
EndIf
EndFunc ;==>_Sendmail
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
$objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ",");文件分格符
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
If FileExists($S_Files2Attach[$x]) Then
$objEmail.AddAttachment($S_Files2Attach[$x])
Else
$i_Error_desciption = $i_Error_desciption & @LF & 'File not found to attach: ' & $S_Files2Attach[$x]
SetError(1)
Return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
If $ssl Then
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet[1]
EndIf
EndFunc ;==>_INetSmtpMailCom
; Com Error Handler
Func MyErrFunc()
$HexHexNumber = Hex($oMyError.number, 8)
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>MyErrFunc
;发送邮件结束====================================================================
;整理内存
Func _ReduceMemory()
$I_PID = @AutoItPID
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $I_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory
标签:
外网IP,邮箱
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“获取外网IP并发送到指定的邮箱的脚本”评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新动态
2024年11月24日
2024年11月24日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]