New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@femessage/direct-mail

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@femessage/direct-mail

send Aliyun DirectMail with Node.js

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

direct-mail

Build Status NPM Download NPM Version NPM License PRs Welcome Automated Release Notes by gren

阿里云 邮件推送 (DirectMail) Node.js SDK(兼容浏览器端)

Table of Contents

Feature

支持以下 API

  • SingleSendMail 单一发信接口,支持发送触发和其他单个邮件
  • BatchSendMail 批量发信接口,支持通过调用模板的方式发送批量邮件

⬆ Back to Top

Install

yarn add @femessage/direct-mail

⬆ Back to Top

Example

发送单个邮件

const directMail = require('@femessage/direct-mail')

const singleConfig = {
  AccountName: 'yourmail@mail.com',
  FromAlias: '化名',
  ToAddress: 'toaddress@mail.com',
  Subject: '标题',
  HtmlBody: '<html>内容</html>',
  AccessKeySecret: '',
  AccessKeyId: ''
}

directMail
  .SingleSendMail(singleConfig)
  .then(resp => {})
  .catch(err => {})

批量发送邮件

const directMail = require('@femessage/direct-mail')

const batchConfig = {
  AccountName: 'yourmail@mail.com',
  ReceiversName: 'defaultReceivers',
  TemplateName: 'offer',
  AccessKeySecret: '',
  AccessKeyId: ''
}

directMail
  .BatchSendMail(batchConfig)
  .then(resp => {})
  .catch(err => {})

dotenv

AccessKeyId、AccessKeySecret 也可以通过环境来设置。

推荐使用dotenv

#.env
ACCESS_KEY_ID=
ACCESS_KEY_SECRET=

则可以在调用时,不用传 AccessKeyId、AccessKeySecret

const config = {
  AccountName: 'yourmail@mail.com',
  FromAlias: '化名',
  ToAddress: 'toaddress@mail.com',
  Subject: '标题',
  HtmlBody: '<html>内容</html>'
}

directMail
  .SingleSendMail(config)
  .then(resp => {})
  .catch(err => {})

⬆ Back to Top

Reference

⬆ Back to Top

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

⬆ Back to Top

License

MIT

⬆ Back to Top

Inspiration

thanks to Mttylzq

Keywords

aliyun

FAQs

Package last updated on 27 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts