ゆるいSEのIT徒然草

SE向けナレッジ(ほぼ自分用メモ)。技術以外にも、システム関連のもろもろ雑多なノウハウを公開します。内容保証しません!!!

メール送信サンプル

■参考
http://www.atmarkit.co.jp/ait/articles/0405/22/news017.html

SendMail.bat
CSCRIPT /NOLOGO SendMail.vbs
EXIT /B 0

SendMail.vbs
Set oMsg = CreateObject("CDO.Message")
oMsg.From = "abc <admin@xxx.co.jp>"
oMsg.To = "user1@xxx.co.jp,user2@xxx.co.jp"
oMsg.Bcc = "user3@xxx.co.jp"
oMsg.Subject = "件名です"
oMsg.TextBody = "本文です。" & vbCrLf & _
  "xxxxxxxx" & vbCrLf & _
  ""
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/languagecode") = "iso-2022-jp"
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.xxxxxxx.jp"
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "admin@xxx.co.jp"
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
oMsg.Configuration.Fields.Update
oMsg.Fields.Update
oMsg.Send
Set oMsg = Nothing