尝试用了Nodemailer来发送邮件,结果成功了,虽然是相对比较简单的,但还是记录一下吧。
Nodemailer 是 Node.js 应用程序的一个模块,可以方便地发送电子邮件。
使用
# 初始化 pageage.json 文件
$ npm init
# 安装依赖
$ npm install nodemailer --save
# 运行
node app.js
app.js
const nodemailer = require('nodemailer');
//开启SMTP连接池
let transporter = nodemailer.createTransport({
host: 'smtp.qq.com',
secureConnection: true, //use SSL
port: