编译后的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
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月23日
2024年11月23日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓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]