簡単な方法の1つは、javascript(またはVBscript)を使用することです。あなたが "Server.CreateObject(" CDO.Message ")のためにGoogleの場合は、より多くの例を見つけるでしょう。
以下のコードを拡張子 ".js"のファイルに入れてください(例:email.js )。コマンドラインで "cscript email.js"を使用して呼び出します。サーバー名と電子メールを有効な値に置き換えます。
Windows 2003にはCDOがインストールされている必要があります。スクリプトはWindows XPとWindows 2003で動作していました。この例ではネットワーク経由でsmtpサーバーを使用していますが、その他のオプションもあります。
Powershellはおそらくサーバー2003で利用可能です。他のオプションもあります。 ==============コード================== ============
関数のsendmail(strFrom、strTo、strSubject、strMessage){ 試み{
objMail = Server.CreateObjectに( "CDO.Message")。 objConfig = Server.CreateObject( "CDO.Configuration"); objFields = objConfig.Fields;
with (objFields) {
項目( "http://schemas.microsoft.com/cdo/configuration/sendusing")= 2;
項目( "http://schemas.microsoft.com/cdo/configuration/smtpserver")= "xxxxsmtp.xxxserver.xxorg";
アイテム( "http://schemas.microsoft.com/cdo/configuration/smtpserverport")= 25;
項目( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")= 30;
Update(); }
with(objMail){
Configuration = objConfig; To = strTo; // "\" ユーザ\ " "\" AnotherUser \";」 = strFromから; 件名= strSubject; TextBody = strMessage; //我々は添付ファイル
//AddAttachment("D:\\test.doc");
Send();
}
}
catch(e) {
WScript.Echo(e.message);
return false;
}
delete objFields;
delete objConfig;
delete objMail;
return true;
を送信する必要がある場合}
//WScript.Echo('qqq ');
SENDMAIL( '[email protected]'、 '[email protected]'、 'テスト'、 'MSG');興味深い
... http://superuser.com/questions/316896/monitoring-script-for-window-services – Buggabill
PowerShell? Net.Mail.SmtpClientはメールを送信できます。 – Fozi