aliyun-email
v1.1.9
Published
阿里云邮件发送SDK
Downloads
14
Readme
AliyunEmail
阿里云邮件发送SDK
Usage
npm i aliyun-email
const AliyunEmail = require('aliyun-email')
const aliyunEmail = new AliyunEmail(AccessKeyId,AccessKeySecret)
本sdk所有参数可以看官方api进行设置,设置opt属性即可
单个邮件推送
aliyunEmail.singleSendMail(opt) => 此函数为返回值为 Promise
opt = {
AccountName: 'xx',
ReplyToAddress: true,
AddressType: 0,
ToAddress: 'xx',
FromAlias: 'xx',
Subject: 'test',
HtmlBody: 'test'
}
以批量发送邮件,其他参数按照自己需要配置 => 此函数为返回值为 Promise
aliyunEmail.batchSendMail({
AccountName: 'xxxx',
ReplyToAddress: true,
AddressType: 0,
TemplateName: 'TemplateName',
ReceiversName: 'ReceiversName',
FromAlias: 'xxxx',
Subject: 'test',
HtmlBody: 'test'
}).then((err, res) => {
console.log(err, res)
});
new AliyunEmail(AccessKeyId,AccessKeySecret)
AccessKeyId
<string> 必填,阿里云颁发给用户的访问服务所用的密钥ID。AccessKeySecret
<string> 必填,AccessKeySecret
构造方法,传入配置对象。
const AliyunEmail = require('aliyun-email')
const AliyunEmail = new AliyunEmail(AccessKeyId, AccessKeySecret)