Skip to content

Instantly share code, notes, and snippets.

@HenrikJoreteg
Created April 28, 2011 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HenrikJoreteg/946686 to your computer and use it in GitHub Desktop.
Save HenrikJoreteg/946686 to your computer and use it in GitHub Desktop.
Example of using sending mail with PostageApp using fermata in node.js
var fermata = require('fermata'),
uuid = require('node-uuid');
var apiKey = 'YOUR_API_KEY'; // should probably be imported from an external keys file
var site = fermata.api({url: 'https://api.postageapp.com/v.1.0'});
exports.send = function (details, cb) {
site['send_message.json'].post(details, cb);
};
exports.sendBetaInvite = function (inviteCode, email, cb) {
exports.send({
api_key: apiKey,
uid: uuid(),
'arguments': {
recipients: [email],
template : "invitation",
variables: {invitecode: inviteCode}
}
}, cb);
};
var postageApp = require('./postageApp'); // assuming they're in the same directory
postageApp.sendBetaInvite('code', 'my@email.com', function (err, result) {
console.log('the result is', result); // outputs data returned
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment