mailman.js
A small Javascript library that sends emails using Mandrill's email service.
Note 8/7/14
Version 0.0.3 is really not an update but only to update the README on npm's end.
Usage
In the browser
In Node.js
npm install mailman.js
var mailman = ;/*note: if that gives you errors try:var mailman = require('.bin/mailman.js');*/
Example: Ping Pong
//create a requestvar request = //mailman uses dot notation to access the url of your desired api call api:"users.ping" //the data to be sent data: key:"your mandrill key here" //enable debug to see tech savvy stuff in the console debug:true//pass in the request to mailman and make the request;//since request() supports "deferred"//you can get the response like so:;
Example: Send Emails
//create a requestvar request = //set the api api: "messages.send" data: message: html:"<p>Example HTML content</p>" text:"Example text content" subject:"example subject" from_email: "example@example.com" from_name: "Example Name" //note that this is an array, therefore you can send //to multiple recipients to: email: "example@example.com" name:"Example" type: "to" //pass the request and make the request;
Making Requests
Visit the Mandrill's documentation. They have examples with the proper JSON format. Requests shown in the examples are following the format.
Available API Call Category
- Users
- Messages
- Tags
- Rejects
- Whitelists
- Senders
- Urls
- Templates
- Webhooks
- Subaccounts
- Inbound
- Exports
- Ips
- Metadata
Tested API
- Users
- Messages
- send
Contribute!
I am currently busy to work on this but if you think you can improve it then go ahead and fork it! For npm users visit github.com/iwatakeshi/mailman.js