0.2.0 • Published 7 years ago

node-notification v0.2.0

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
7 years ago

node-notification NPM version Build Status Dependency Status Coverage percentage

Node Notification with Email, SMS.

Install

$ npm install --save node-notification

Usage

var notifier = require('node-notification');
//短信
var mailOptions = {
  from: process.env.NN_FROM,
  to: process.env.NN_TO,
  subject: 'hello world!',
  body: 'Greeting from'
};
var smtpOptions = {
  host: 'smtp.exmail.qq.com',
  port: 465,
  secure: 'true',
  password: process.env.NN_PASSWORD,
  email: process.env.NN_EMAIL
};
var sender = notifier.senders.mailer;
sender.send(smtpOptions, mailOptions, function(error, data) {
  //data:返回的json数据
});

//短消息    
var config = {
  url: 'sandboxapp.cloopen.com',
  port: 8883,
  version: '2013-12-26',
  appId: process.env.NN_APPID,
  accountSid: process.env.NN_ACCOUNTSID,
  accountToken: process.env.NN_ACCOUNTTOKEN
};
var data = {
  phone: process.env.NN_PHONE,
  params: [' 云通讯测试', "" + Math.round(Math.random() * 1000000) ],
  templateId: '1'
};
var sms = notifier.senders.sms;
sms.send(config, data, function(error, data) {
  assert.equal(true, !error);
  assert.equal(true, data.statusCode === '000000');
  done();
});

License

Apache-2.0 © calidion

0.2.0

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.6

8 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago