ã³ãã³ãã©ã¤ã³ã§ã¡ã¼ã«éä¿¡ããæ¹æ³ãï¼Windowsã®ãããã§SMTPéä¿¡ãCDO.Messageã使ç¨)
ããã¸ã§ã¯ãã«ï¼ã³ãã¥ãã±ã¼ã·ã§ã³ã¹ãã«ã®ä½ãã¡ã³ããããå ´åï¼ã©ãããããããã
ä¸ã¤ã®æ¹æ³ã¯ï¼ãã®äººã®ä½æ¥ãï¼ä½ããã®æ段ã«ãã£ã¦ãè¦ããåããããã¨ã
æ軽ãªæ¹æ³ã¨ãã¦ï¼ä¸è¨ã®ãããªæãããã
- ããã¸ã§ã¯ãå ã§ã®å ±éæä½ï¼ä¾ãã°ï¼ãããã¤ã¹ã¯ãªããã®å®è¡ãï¼ãã¹ããµã¼ãã¸ã®ãã¼ã¿æå ¥ãªã©ã®ã¿ã¹ã¯ï¼ãï¼ãããåããã
- ãã®ããããï¼ãã¼ã¸ã§ã³ç®¡çã·ã¹ãã ä¸ã«ç½®ãã¦ï¼å ¨å¡ãå©ç¨ããããã«ããã
- ãããã¯ï¼SVNã³ãããã®ããã¯ã¹ã¯ãªããã®ããã«ï¼å種ãã¼ã«å©ç¨æã®åä¼´ç©ã¨ããå½¢ãã¨ã£ã¦ãããã
- ããã¦ï¼ãã®ãããã®ä¸ã«ï¼ã¡ã¼ã«éä¿¡å¦çãä»è¾¼ãã
ããã¡ã³ããï¼éçºä½æ¥ã«é¢ãããããªä½ããã®ã¢ã¯ã·ã§ã³ãåã£ããï¼
ãã®äºãéçºã¡ã³ãå ¨å¡ã«èªåéç¥ãããï¼ã¨ããããã
以ä¸ã¯ï¼ãããã£ãbatãã¡ã¤ã«å ã«çµã¿è¾¼ã¿å¯è½ãªï¼WSHã«ããã¡ã¼ã«éä¿¡ã¹ã¯ãªããã
ã½ãããDLLã¯ãã£ããä¸è¦ãWindowsããããã°ããã
WSHå´
send_mail.js
// ã¡ã¼ã«éä¿¡ã¢ã¸ã¥ã¼ã« // // cscript //nologo send_mail.js "件å" "æ¬æ" // å¼æ°ãåå¾ var mail_subject = WScript.Arguments.Unnamed(0); var mail_body = WScript.Arguments.Unnamed(1); // è¨å®é ç® var from_mail_address = "ã¡ã¼ã«éä¿¡å ã®ã¡ã¼ã«ã¢ãã¬ã¹"; var to_mail_addresses = "ã¡ã¼ã«éä¿¡å ã®ã¡ã¼ã«ã¢ãã¬ã¹ï¼åè§ã«ã³ãåºåãï¼"; var smtp_server_name = "ã¡ã¼ã«éä¿¡ãµã¼ãå"; // -------- ãã¼ã«ã«ãã·ã³ã§ã®ã³ãã³ãã®å®è¡çµæãåå¾ããé¢æ° -------- var ws = WScript.CreateObject("WScript.Shell"); // ã³ãã³ãå®è¡çµæãè¡ãã¨ã«é åã¨ãã¦åå¾ function cmd_output_arr( str_cmd ) { // ã³ãã³ãå®è¡ var proc = ws.Exec( "cmd /c " + str_cmd ); // çµäºã¾ã§å¾ 㤠while( proc.Status == 0 ) { WScript.Sleep(100); } // åºåãåå¾ var str_out = proc.StdOut.ReadAll(); // æ«å°¾ã®ç©ºè¡ãåé¤ var arr = str_out.split("\r\n"); arr.pop(); return arr; } // ã³ãã³ãå®è¡çµæãæååã¨ãã¦åå¾ function cmd_output( str_cmd ) { return cmd_output_arr( str_cmd ).join("\r\n"); } // -------- ã¡ã¤ã³å¦ç -------- var mail = WScript.CreateObject("CDO.Message"); var schemas = "http://schemas.microsoft.com/cdo/configuration/"; // ã¡ã¼ã«å 容ã«é¢ããè¨å® mail.From = from_mail_address; mail.To = to_mail_addresses; mail.Subject = mail_subject; mail.TextBody = mail_body + "\r\n\r\n" + "æ¥æï¼" + cmd_output( "@echo %DATE% %TIME%" ) + "\r\n" + "ãã·ã³åï¼" + cmd_output( "@hostname" ) + "\r\n" + cmd_output( '@ipconfig | findstr /C:"IP Address"' ) + "\r\n" ; mail.TextBodyPart.Charset = "ISO-2022-JP"; // ã¡ã¼ã«éä¿¡ã«é¢ããè¨å®(XP Proãªãä¸è¦) mail.Configuration.Fields.Item( schemas + "sendusing" ) = 2; mail.Configuration.Fields.Item( schemas + "smtpconnectiontimeout" ) = 30; mail.Configuration.Fields.Item( schemas + "smtpserver" ) = smtp_server_name; mail.Configuration.Fields.Item( schemas + "smtpserverport" ) = 25; mail.Configuration.Fields.Update(); // éä¿¡ mail.Send();
ããã ãããã°ï¼ã³ãã³ãã©ã¤ã³ããã¡ã¼ã«éä¿¡ã§ããã
ï¼ä½¿ãæ¹ã¯ï¼ã½ã¼ã¹ã³ã¼ãå
åé ã®ã³ã¡ã³ããåç
§ãï¼
ãã®ãããã®å®è¡è ã®ãã·ã³åã¨IPã¢ãã¬ã¹ãï¼ã¡ã¼ã«æ¬æå ã«è¨è¼ãããã
WSHããã¡ã¼ã«éä¿¡ããã¨ãã®ã¡ã¢
http://muumoo.jp/news/2007/02/21/0wsh...
- SMTPèªè¨¼
- æ·»ä»ãã¡ã¤ã«
- SSL
- ãã ãï¼POP before SMTPã ãã¯BASP21ãå¿ è¦
Windowsæ¨æºæ©è½ã¨WSHã使ã£ã¦ã¡ã¼ã«ãéä¿¡ãã
http://www.atmarkit.co.jp/fwin2k/win2...
Windows XP Home Editionã«ã¯SMTPãµã¼ãã¹ã¯æä¾ããã¦ããªã
ã³ãã³ãããã³ããã§ã³ã³ãã¥ã¼ã¿åã確èªããã
http://date07.blog114.fc2.com/blog-en...
BATå´
ä¸è¨ã®ã¡ã¼ã«éä¿¡ã¹ã¯ãªãããï¼ãããå´ããå¼ã³åºãã
@rem ä½ãã®å¦ç ãããããã @rem å ¨ã¡ã³ãã«ã¡ã¼ã«éç¥ cscript //nologo send_mail.js @pause
è£è¶³
以ä¸ã¯ï¼SMAILã¨ããããªã¼ã½ããã使ãæ¹æ³ã
ã³ãã³ãã©ã¤ã³ã§ã¡ã¼ã«éä¿¡ããæ¹æ³ãï¼ãªãã¤ã³ãã·ã¹ãã ãï¼åã§ä½ããï¼
http://language-and-engineering.hatenablog.jp/entry/20081029/1225242779
é¢é£ããè¨äºï¼
é¢å¸ä¸ã®ãã£ããã®ãã°ãèªåã§ã¡ã¼ã«éä¿¡ãã¦ãããã½ããã®ä½ãæ¹
http://language-and-engineering.hatenablog.jp/entry/20081207/1228642113
Railsã§GMailãå©ç¨ããã¡ã¼ã«éä¿¡ãï¼ActionMailer + tlsmailã®ä»çµã¿ãç解ãããï¼
http://language-and-engineering.hatenablog.jp/entry/20091123/p1
Androidã¢ããªã§ï¼HTTPéä¿¡ã®POSTãªã¯ã¨ã¹ããããæ±ç¨ã¯ã©ã¹ ï¼æååãç¡ãï¼éåæã¿ã¹ã¯ï¼
http://language-and-engineering.hatenablog.jp/entry/20111121/p1
ã