You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
803 B
32 lines
803 B
// uniCloud/cloudfunctions/sendMail/index.js |
|
|
|
'use strict'; |
|
const nodemailer = require('nodemailer') |
|
|
|
// 创建一个SMTP客户端配置 |
|
var config = { |
|
host: 'smtp.qq.com', // 网易163邮箱是 smtp.163.com |
|
port: 465, // 网易邮箱端口是 25 |
|
auth: { |
|
user: '1337425156@qq.com', // 邮箱账号 |
|
pass: 'yidyoatxwswwjgjj', // 邮箱的授权码 |
|
} |
|
}; |
|
|
|
exports.main = async (event, context) => { |
|
let transporter = nodemailer.createTransport(config); |
|
const content = event.content; |
|
// 创建一个邮件对象 |
|
var mail = { |
|
// 发件人 |
|
from: '1337425156@qq.com', |
|
// 主题 |
|
subject: 'Uniapp[Chameleon] 用户反馈', |
|
// 收件人 |
|
to: '15270405776@163.com', |
|
// 邮件内容,text或者html格式 |
|
text: content, |
|
}; |
|
const info = await transporter.sendMail(mail); |
|
return info |
|
}
|
|
|