2012年8月8日水曜日

mail


//モジュールロード
var nodemailer = require("nodemailer");
//埋め込み画像のファイル名に使用
//var cid = Date.now()+".image.png";

//SMTPサーバーの設定
nodemailer.SMTP = {
        host: "mail.c",
port:587,
//      ssl:true,
        use_authentication:true,
       user:"kawamoto_junichi@c",  
     pass:""
};

//メール情報の作成
var message = {      
sender:'kawamoto_junichi@c',
       to:'',
       subject:'【必ず読んでください】WindowsログインID変更のお知らせ!!!',    
  body:"Hello to myself",  
    html:"各位<br>8/11(土)WinodwsIDを社員番号へ変更を致し>ます。<br>■注意意!<br>WindowsID変更後は、必ず再起動を行ってください。",
debug:true
};

//メール送信のコールバック関数
var callback = function(error, success){      
if(error){              
 console.log("Error occured");  
             console.log(error.message);  
            return;  
     }      
 if(success){  
            console.log("Message sent successfully");
        }else{
                console.log("Message failed,reschedule!");        }
};

//メール送信
var mail;
try{
        mail = nodemailer.send_mail(message, callback);
}catch(e){
        console.log("Caught Exception", e);
}



0 件のコメント:

コメントを投稿