忍者ブログ
JavaScript , Java , DOS , HTML(CSS) , JSP , SQL , VB , VBScript , ・・・etc などの覚書
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

VBScriptとJavaScript の2つの方法を記載する。

●VBScript (SMTPサーバーが自分の場合)
Set oMsg = CreateObject("CDO.Message")
oMsg.From = "fromMail@dummy.co.jp"
oMsg.To = "toMail@dummy.co.jp"
oMsg.Subject = "Test "
oMsg.TextBody = "テストメッセージです" & vbCrLf & Now
oMsg.Send

●JScript (SMTPが自分でない場合)
var oMsg = WScript.CreateObject("CDO.Message");
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")= 2;
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "SMTPサーバ名";
oMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")= 25;
oMsg.Configuration.Fields.Update();
oMsg.From     = "fromMail@dummy.co.jp";
oMsg.To       = "toMail@dummy.co.jp";
//oMsg.CC       = "toMail@dummy.co.jp";
oMsg.Subject  = "タイトル";
oMsg.TextBody = "メールの本文";
oMsg.Send();


どちらも、スクリプトファイルとして保存し、コマンドプロンプト上から

cscript スクリプトのフルパス

で実行できる。
PR
ブログ内検索
カレンダー
05 2025/06 07
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

Copyright © [ moriBlog-memo ] All rights reserved.
Special Template : 忍者ブログ de テンプレート Special Thanks : 忍者ブログCommercial message : [PR]