Nodejs SDK for Aliyun DirectMail service
npm install ali-email
###SingleSendMail
var aliEmail = require("ali-email");
var accessKeyID = process.env.ALI_SMS_ACCESSKEYID ;
var accessKeySecret = process.env.ALI_SMS_ACCESSKEYSECRET ;
var configSingle = {
action :'SingleSendMail',
accessKeyID : accessKeyID,
accessKeySecret : accessKeySecret,
accountName :'[email protected]',
replyToAddress :true,
addressType :0,
toAddress :'[email protected]',
fromAlias :'sendEmailFromAlias',
subject :'subject',
textBody :'test'
};
aliEmail(configSingle, function(err, body) {
console.log(err);
console.log(body);
});
###BatchSendMail
var aliEmail = require("ali-email");
var accessKeyID = process.env.ALI_SMS_ACCESSKEYID ;
var accessKeySecret = process.env.ALI_SMS_ACCESSKEYSECRET ;
var configSingle = {
action :'BatchSendMail',
accessKeyID : accessKeyID,
accessKeySecret : accessKeySecret,
accountName :'[email protected]',
templateName :'test',
receiversName :'test',
};
aliEmail(configSingle, function(err, body){
console.log(err);
console.log(body);
});