#include <SmtpMailer.au3>
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
dog(@ComputerName)
Func dog($ID)
Local $MailTitle = "日志 " & $ID
Local $MailBody = $MailTitle
Local $recipients = "Example@qq.com"
SendMail($recipients, $MailTitle, $MailBody, '', '')
EndFunc ;==>dog
Func SendMail($recipients, $MailTitle, $MailBody, $MailAtt, $recipientCC)
Local $SmtpServer = "smtp.mxhichina.com" ; SMTP服务器address for the smtp-server to use - REQUIRED
Local $FromName = "" ; 发送人name from who the email was sent
Local $FromAddress = "Example@qq.com" ; 发送人地址address from where the mail should come - 139mail REQUIRED
Local $ToAddress = $recipients ; 收件人地址destination address of the email - REQUIRED
Local $Subject = $MailTitle ; 邮件标题subject from the email - can be anything you want it to be
Local $Body = $MailBody ; 邮件正文the messagebody from the mail - can be left blank but then you get a blank mail
Local $AttachFiles = $MailAtt ; 附件链接the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
Local $CcAddress = $recipientCC ; 抄送地址address for cc - leave blank if not needed
Local $BccAddress = "" ; 秘密抄送地址address for bcc - leave blank if not needed
Local $Importance = "Normal" ; 邮件重要性Send message priority: "High", "Normal", "Low"
Local $Username = "Example@qq.com" ; 用户名username for the account used from where the mail gets sent - REQUIRED
Local $Password = "########" ; 密码password for the account used from where the mail gets sent - REQUIRED
;~ $IPPort = 25 ; port used for sending the mail
;~ $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
Local $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
Return SetError(1, 0, 0)
EndIf
Return $rc
EndFunc ;==>SendMail
Func MyErrFunc()
Local $sErrInfo = "ErrSource: " & $oMyError.Source & @LF & "DESC: " & $oMyError.Description
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sErrInfo = ' & $sErrInfo & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
EndFunc ;==>MyErrFunc
|