#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: H. Tsubota
Script Function:
メールの送信(SMTP)
注: GmailをSMTPサーバーとして使用する場合、
Gmailの設定でPOPを有効にしておく必要がある。
参照: http://mail.google.com/support/bin/answer.py?hl=ja&answer=13287
#ce ----------------------------------------------------------------------------
SendMail( _
"smtp.gmail.com", _
"件名", _
'"WhiteGoat" <WhiteGoat@gmail.com>', _
"BlackGoat@i.softbank.jp", _
"これはテスト", _
1, _
"WhiteGoat@gmail.com", _
"YourPassword", _
587 _
)
Func SendMail( _
$sSMTPServer, _
$sSubject, _
$sFrom, _
$sTo, _
$sMessage, _
$iAuthenticate = 0 , _ ;0: None, 1:basic (clear-text) , 2: NTLM
$sUserName = "" , _
$sPassword = "" , _
$iPort = 25 )
$oMessage = ObjCreate("CDO.Message")
$oMessage.Subject = $sSubject
$oMessage.From = $sFrom
$oMessage.To = $sTo
$oMessage.TextBody = $sMessage
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $sSMTPServer
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = $iAuthenticate
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = $sUserName
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $sPassword
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $iPort
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
$oMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
$oMessage.Configuration.Fields.Update
$oMessage.Send
EndFunc