Appearance
mail 邮件
提供邮件相关操作功能
js
const mail = require('mail')
create 创建
参数
参数 | 类型 | 说明 |
---|---|---|
host | string | |
port | number | 端口 |
username | string | 用户名 |
password | string | 密码 |
encoding | string | 编码(可空) |
protocol | string | 协议(可空) |
ssl | boolean | |
authorization/auth | boolean |
返回值
object
代码
javascript
const mail = require('mail').create({
host: 'smtp.qq.com',
port: 465,
username: '123456@qq.com',
password: 'authorization',
ssl: true
})
send 发送
参数
参数 | 类型 | 说明 |
---|---|---|
from | string | 发信人(可空) |
to | string | 收信人 |
subject | string | 主题 |
html/text | string | 内容 |
返回值
无
代码
javascript
mail.send({
to: '10000@qq.com',
subject: '验证码',
text: '验证码: 123456'
})