云函数发送email极简代码
const mailer = require('nodemailer-promise')
exports.main = async (event, context) => {
let sendEmail = mailer.config({
host: 'smtp.exmail.qq.com', //换成你邮箱的smtp
port: 465,
secure: true, //检查你邮箱的smpt服务器的设置
auth: {
user: 'mailer@mycite.cn', //换成你的邮箱账号和密码
pass: 'Pwd'
}
})
let message = {
from: 'anywords',
to: event.to,
subject: event.subject,
text: event.text,
}
return await sendEmail(message)
}
[图片]