/ Published in: AutoIt
Expand |
Embed | Plain Text
#Region ;**** 参数创建于 ACNWrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\..\..\素材\Icons\Minicons_by_Asher\Mail.ico #AutoIt3Wrapper_UseX64=n #EndRegion ;**** 参数创建于 ACNWrapper_GUI **** ; ;################################## ; Include ;################################## #include<file.au3> ;################################## ; Variables ;################################## $SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $FromName = "Qoli" ; name from who the email was sent $FromAddress = "E-MAIL" ; address from where the mail should come $ToAddress = "?@bannka.com" ; destination address of the email - REQUIRED $Subject = InputBox("发微博", "微博内容?!", "") ; subject from the email - can be anything you want it to be $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = $CmdLine[1] ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "USER" ; username for the account used from where the mail gets sent - REQUIRED $Password = "PASS" ; 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 $IPPort = 465 ; GMAIL port used for sending the mail $ssl = 1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS ;################################## ; Script ;################################## $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.BodyPart.Charset = "GB2312" $objEmail.HTMLBodyPart.Charset = "GB2312" $objEmail.Subject = $s_Subject $objEmail.HTMLBody = $as_Body $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console $objEmail.AddAttachment($S_Files2Attach[$x]) Return 0 $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 $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 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" $objEmail.Fields.Update ; Sent the Message $objEmail.Send $objEmail = "" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler $oMyRet[0] = $HexNumber ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) EndFunc ;==>MyErrFunc
You need to login to post a comment.
