Skip to content

Instantly share code, notes, and snippets.

@chyld
Created March 6, 2014 15:07
Show Gist options
  • Save chyld/9391721 to your computer and use it in GitHub Desktop.
Save chyld/9391721 to your computer and use it in GitHub Desktop.
9 var fs = require('fs');
10 var request = require('request');
11 var url = 'https://api:[email protected]/v2/YOURDOMAIN/messages';
12 var post = request.post(url, function(err, response, body){
13 res.send({});
14 });
15 var form = post.form();
16 form.append('from', '[email protected]');
17 form.append('to', '[email protected]');
18 form.append('subject', 'hey from node.js');
19 //form.append('text', 'this is super cool');
20 form.append('html', '<h1>omg</h1>');
21 form.append('attachment', fs.createReadStream(__dirname + '/../static/img/horse.jpg'));
22 form.append('attachment', fs.createReadStream(__dirname + '/../static/img/walle.jpg'));
23 };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment