首先要設定BlatMail,需要指定SMTP server與送件者郵件信箱
程式 :
Func _SendBlatMail($pSubject,$pBody,$pMailAddresses) Local $sMailExec = "" Local $sBlatPath = IniRead("Config.ini", "BlatMail", "Path", "NotFound") If $sBlatPath <> "NotFound" And $pMailAddresses <> "" Then $sMailExec = $sBlatPath & "blat.exe" $aAddress = StringSplit($pMailAddresses, ",") ;以逗號區隔收件人 For $i = 1 To $aAddress[0] ; 可能有多個號碼 _SendMail($pSubject,$pBody,$aAddress[$i],$sMailExec) ;傳送Mail Next EndIf EndFunc Func _SendMail($pSubject, $pBody, $sendTo,$sMailExec) ; Note: -charset big5 傳送中文 Local $sParm = " - -body """ & $pBody & """ -subject """ & $pSubject & """ -to " & $sendTo & " -charset big5" ShellExecute($sMailExec, $sParm, @ScriptDir, "", @SW_HIDE) ;hide blat console EndFunc
Hello Fred,
回覆刪除透過Google快訊收到你的這篇文章,真是好巧啊:)
關於AutoIt發送mail的方式,除了透過呼叫外部blatmail程式方式外,還可以透過"_INetSmtpMailCom" #include 方式更為直接喔~
Tony