In the actual application, sometimes requires the server has the characteristics of the information timely push message to you, and let you have prepared and processed, the number of servers in the project is more, so the Management server cluster is not very convenient, I am the exception that occurs on each server when you exit, send mail to my mailbox and restart the Nodejs server.
Needless to say, the examples are:
First, you need to install a module that sends the message:
install mailer
Then introduce the module in the code:
varrequire("mailer");
Finally send the message using the module:
Email. Send({ssl:true, Host:"Smtp.exmail.qq.com",//Send SMTP. QQ. comReceivePop. QQ. comDomain"[xxx.xxx.xxx.xxx]",//You can enter HTTP://IP in the browser. QQ. com/Get to:"[email protected]", from:"[email protected]", Subject:"myemail Test Email",//reply_to:"[email protected]", Body:"hello! This is a test of the myemail. ", authentication:"Login", Username:"[email protected]", Password:"XXX", Debug:false}, function (err, result) {if (ERR) {Console. Log("The Err:"+ err);Response. Write(JSON. Stringify({"Prompt Information":"Send Failed","Reason for failure":"Data Exception"}));Response. End();} else {if (result) {Console. Log("sent successfully");Response. Write(JSON. Stringify({"Prompt Information":"sent successfully"}));Response. End();} else {response. Write(JSON. Stringify({"Prompt Information":"Send Failed","Reason for failure":"Data Exception"}));Response. End();} } } );
Nodejs This module is easy to use and I hope to help you.
Code Download: http://download.csdn.net/detail/qxs965266509/8896463
Hope can help everyone, you have to help or feel worthy of reference, you can click on the below a praise! Thank you!!!
If there is reprint please famous from http://blog.csdn.net/qxs965266509
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Nodejs Sending mail using mailer