Permalink
Browse files

First commit!

  • Loading branch information...
0 parents commit c8d720b372b561ce33eb6c2fd6208574ee1e94ae @JonLim JonLim committed Jul 7, 2011
Showing with 54 additions and 0 deletions.
  1. +1 −0 index.js
  2. +39 −0 lib/postageapp.js
  3. +14 −0 package.json
@@ -0,0 +1 @@
+module.exports = require('./lib/postageapp');
@@ -0,0 +1,39 @@
+var http = require('http');
+
+var apiKey = 'SkC3ov2fRrEv7Oe3RHsqY7WtJbtTdVe4';
+
+var postageapp = module.exports = {
+ apiCall: function (emailRecipients, emailContent, emailSubject, emailFrom, emailVariables) {
+ var api = http.createClient(80, 'api.postageapp.com');
+
+ var request = api.request('POST', '/v.1.0/send_message.json',
+ {
+ 'host': 'api.postageapp.com',
+ 'content-type': 'application/json',
+ 'user-agent': 'Node.JS v0.4.0'
+ });
+
+ var date = new Date;
+ var epochDate = date.getTime();
+
+ var payload = {
+ api_key: apiKey,
+ uid: epochDate,
+ arguments: {
+ recipients: emailRecipients,
+
+ headers: {
+ subject: emailSubject,
+ from: emailFrom
+ },
+
+ content: emailContent
+
+ }
+ }
+
+ request.on('response', function (response) {});
+ request.end(JSON.stringify(payload));
+
+ }
+}
@@ -0,0 +1,14 @@
+{
+ "name": "postageapp",
+ "version": "0.0.1",
+ "homepage": "",
+ "repository": {
+ "type":"git",
+ "url":""
+ },
+ "author": {"name":"PostageApp", "url":"http://postageapp.com"},
+ "contributors": [{"name":"Jon Lim", "email": "jon@postageapp.com", "url":"http://postageapp.com"}],
+ "description": "Node.JS package for sending emails through PostageApp",
+ "licenses": [{"type": "MIT", "url": ""}],
+ "main": "index"
+}

0 comments on commit c8d720b

Please sign in to comment.