Occasionally, I need to send an email. I used to use Python for my work. Now I want to use my own mail. Everything is concise. As in the past, I entered npm search xxx in the command line, but this xxx is mail, and everything is concise. Then I saw nodemailer in the long search results, the introduction is "Easy to use module to send e-mails, supports unicode and SSL/TLS ". After installation, try it out to meet your needs.
It is also used in readme. An example is as follows:
Var nodemailer = require ("nodemailer"); var transport = nodemailer. createTransport ("SMTP", {host: "smtp.126.com", secureConnection: true, // use SSL port: 465, // port for secure SMTP auth: {user: "1234567@126.com ", pass: "xxxxxxx"}); transport. sendMail ({from: "1234567@126.com", to: "13JQQQQKKAA@126.com", subject: "theme? ", GenerateTextFromHTML: true, html:" Ah, hahaha "}, function (error, response) {if (error) {console. log (error);} else {console. log ("Message sent:" + response. message);} transport. close ();});