0.0.3 • Published 10 years ago

mailman.js v0.0.3

Weekly downloads
12
License
-
Repository
-
Last release
10 years ago

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

<script src="mailman.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

###In Node.js

npm install mailman.js
var mailman = require('mailman.js');
/*note: if that gives you errors try:
var mailman = require('.bin/mailman.js');
*/

##Example: Ping Pong

//create a request
var 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
mailman(request).request();
//since request() supports "deferred"
//you can get the response like so:
mailman(request).request().done(function(response){
    //do something with response
});

##Example: Send Emails

//create a request
var 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
mailman(request).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

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago