GitXplorerGitXplorer
Y

AliMail-SDK

public
1 stars
3 forks
15 issues

Commits

List of commits on branch master.
Unverified
ee8658d0c7af9d9910c99aa708299b28ef2573b1

version: 1.0.6

YYeungKC committed 5 years ago
Unverified
25bd3caf4b83ceda6f8b5a91d2dcb76ac9449f02

refactor: update dependencies

YYeungKC committed 5 years ago
Unverified
92c4d7e17f0bf9612c79db4a70de831d88e99b5f

refactor(test)

YYeungKC committed 5 years ago
Unverified
3dea9aadf103db7f03ae21706cbf7a91cc67f89f

version(1.0.5 and README.md)

YYeungKC committed 5 years ago
Unverified
3638983216c966a55dcd99cda8cbb27e74151d4d

refactor(utils file name)

YYeungKC committed 5 years ago
Unverified
fed4abb4ee73228b8df82d14e2c45018e10461d6

version(1.0.4): remove request

YYeungKC committed 5 years ago

README

The README file for this repository.

AliMail-SDK

Use AliYun DirectMail service with JavaScript

Codacy Badge codecov Build Status NPM version NPM download Known Vulnerabilities dependencies Status devDependencies Status

install

yarn add alimail-sdk

Example

const AliMailSDK = require('alimail-sdk');

!(async () => {
  const mailer = new AliMailSDK({
    AccessKeyId: 'AccessKeyId',
    AccessKeySecret: 'AccessKeySecret',
    Version: '2015-11-23', // RegionID 是 cn-hangzhou version 是 2015-11-23,其他一律 2017-06-22
    SignatureVersion: '1.0', // 默认并仅支持 1.0
    SignatureMethod: 'HMAC-SHA1', // 默认并仅支持 HMAC-SHA1
    RegionId: 'cn-hangzhou', // 可选
    Format: 'json' // 可选
  })

  const singleRes = await mailer.send(
    {
      Action: 'single',
      AccountName: 'admin@alimail.yeungkc.com',
      ReplyToAddress: false, // 默认 false
      AddressType: 0, // 默认 0
      ToAddress: 'alimail@YeungKC.com',
      FromAlias: 'alias', // 可选
      Subject: 'subject', // 可选
      TagName: 'test', // 可选
      HtmlBody: '<html>HtmlBody</html>', // 可选
      TextBody: 'TextBody', // 可选
      ClickTrace: '0' // 默认 0
      // Timestamp: new Date().toISOString(), // 默认 new Date().toISOString()
      // SignatureNonce: uuid() // 默认 UUID
    },
    {} // 传入 axios config 设置代理等
  )
  console.log(singleRes) // axios respone

  const batchRes = await mailer.send(
    {
      Action: 'batch',
      AccountName: 'admin@alimail.yeungkc.com',
      AddressType: 0, // 默认 0
      TemplateName: 'test',
      ReceiversName: 'listname',
      ClickTrace: '0' // 默认 0
      // Timestamp: new Date().toISOString(), // 默认 new Date().toISOString()
      // SignatureNonce: uuid() // 默认 UUID
    },
    {} // 传入 axios config 设置代理等
  )
  console.log(batchRes) // axios respone
})()