{"_id":"mailgun","_rev":"54-dc10bff66d03bf25b5f87fb27041bd33","name":"mailgun","description":"Mailgun for Node.js","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.6":{"name":"mailgun","version":"0.1.6","description":"Mailgun API for Node.js","author":{"name":"shz"},"repositories":[{"type":"git","url":"git@github.com:shz/node-mailgun.git"}],"main":"./mailgun","dependencies":{},"devDependencies":{},"_id":"mailgun@0.1.6","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"9d0b5b1be9b5ea99427c7941f00d7c243b458f75","tarball":"https://registry.npmjs.org/mailgun/-/mailgun-0.1.6.tgz","integrity":"sha512-/iwPWqJQEvOck1vOTcd8CUfeAyTP+4MyDqG/J3hq2EbAUa2PrqkkEAmZsl4lRxTqxWeQTQJvjIrnUcxzK8E+DQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDnjU+LkYP2etdCOHRwNBPPeI+ytUBKV40N6NIYMSVgwIhAJYbVxV0r4nHGMiZYPgpEKqRVkiejeAqLwrbcivcBEPp"}]},"scripts":{},"directories":{}},"0.4.0":{"name":"mailgun","version":"0.4.0","description":"Node.js interface to the Mailgun API","author":{"name":"shz"},"repositories":[{"type":"git","url":"git@github.com:shz/node-mailgun.git"}],"main":"./mailgun","_npmJsonOpts":{"file":"/home/patrick/.npm/mailgun/0.4.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"mailgun@0.4.0","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"34a3082bfe4e08172d0846fec7faedd1059a95d0","tarball":"https://registry.npmjs.org/mailgun/-/mailgun-0.4.0.tgz","integrity":"sha512-9yrByOaa5IWKiQcGe4PQdCQo5bH1nrAp+excD4rYb/59fSUVSOKmIJfO6knZyKO+fmQB0+atX7O6MZOATxbvJA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPOFrC3KHIyGdCPzyk4NhbfwVTPSvkwnJsCIETWBsdvAIgShPJz0nNDLj6MuBOMRSZbhTFB1FAqE4Q0xhcipYV/uI="}]},"scripts":{},"directories":{}},"0.4.1":{"name":"mailgun","version":"0.4.1","description":"Mailgun for Node.js","author":{"name":"shz"},"repository":{"type":"git","url":"git@github.com:shz/node-mailgun.git"},"main":"./mailgun","homepage":"http://github.com/shz/mailgun","engine":"node","_npmJsonOpts":{"file":"/Users/patrick/.npm/mailgun/0.4.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"mailgun@0.4.1","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"7486c7e18a656579abd571cdbce301ac20d58a9b","tarball":"https://registry.npmjs.org/mailgun/-/mailgun-0.4.1.tgz","integrity":"sha512-byahA6tbaGJbzujnRpHPL5ASzunRCPFHlsovA/B8naR0KS1xGZZQ5zwJam/1z7TfSR2oyXMVGN8SHXkVheepUg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC0QeaOmx6idk5jIr0NS8HFs8K1gEpv6kdQNpFOAMFT2AiEA1R/hTyfB+FwCR04ljYDwURZfBMhjgBdqx3QoO63sdNw="}]},"scripts":{},"directories":{}},"0.4.2":{"name":"mailgun","version":"0.4.2","description":"Mailgun for Node.js","author":{"name":"shz"},"repository":{"type":"git","url":"git@github.com:shz/node-mailgun.git"},"main":"./mailgun","homepage":"http://github.com/shz/mailgun","engine":"node","_npmJsonOpts":{"file":"/Users/patrick/.npm/mailgun/0.4.2/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"mailgun@0.4.2","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"17a782051857971cf5f00075bce43a0a07909ccf","tarball":"https://registry.npmjs.org/mailgun/-/mailgun-0.4.2.tgz","integrity":"sha512-NKwjeTZvLx3LCOmH3OeA2PpE5LjHQrz0IlGlGA16i8JWYCjKH42icYGkPijjLniv/xCxcm5nezjOUJyfO0/2pQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOx/d29T3VnL9SktpJJnjgqrm4LOKAhE119rg03gLIDAIgeYQjpGwsNF+Cz+dPiD3RcIco3TW0TKN35D19WS1JjeM="}]},"scripts":{},"directories":{}},"0.4.3":{"name":"mailgun","version":"0.4.3","description":"Mailgun for Node.js","author":{"name":"shz"},"repository":{"type":"git","url":"git@github.com:shz/node-mailgun.git"},"main":"./mailgun","homepage":"http://github.com/shz/node-mailgun","engine":"node","bugs":{"url":"https://github.com/shz/node-mailgun/issues"},"_id":"mailgun@0.4.3","dist":{"shasum":"f9796fdd30a711685441ebebd00f92031b69f809","tarball":"https://registry.npmjs.org/mailgun/-/mailgun-0.4.3.tgz","integrity":"sha512-fzMt9BHpI8Zt7NlVcOQ2yyq5B4BOi+/0zdJFZU2OsuqpryJ/wr46kQ5+SXMIf3OtnB3uFJ84tIiPz17KvFL04A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG7qy2eZ5fYQCYRdOKd7/IAVSE0gm05aBSmrhCAeo1ZEAiEA/OIzpyJp3qKs56wAVdDYePyqvjGFtMhcCkcLqMWoLHI="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"shz","email":"lylepstein@gmail.com"},"maintainers":[{"name":"shz","email":"lylepstein@gmail.com"}],"directories":{}},"0.5.0":{"name":"mailgun","version":"0.5.0","description":"Mailgun for Node.js","author":{"name":"shz"},"repository":{"type":"git","url":"git@github.com:shz/node-mailgun.git"},"main":"./mailgun","homepage":"http://github.com/shz/node-mailgun","engine":"node","bugs":{"url":"https://github.com/shz/node-mailgun/issues"},"_id":"mailgun@0.5.0","_shasum":"bce0f3134a6d788b6f2368f71784ef20277cd697","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"shz","email":"lylepstein@gmail.com"},"maintainers":[{"name":"shz","email":"lylepstein@gmail.com"}],"dist":{"shasum":"bce0f3134a6d788b6f2368f71784ef20277cd697","tarball":"https://registry.npmjs.org/mailgun/-/mailgun-0.5.0.tgz","integrity":"sha512-g0qrj4RP7l3S6+9Fb7x0nTmRoR+oB1rm68iEuSg3IKJir67b9RE5kfsNyK3ZenVgDCLRCdtaheDiybjkSYeZRA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAbNUChqt5HHx/0G9vg0dRp5Cp3PUFH7Qu+PX5bpRmbqAiEApZXP8fDCBBOdQj1BUIHWN4yyunDltFf8SUEb8c+GXOY="}]},"directories":{}}},"maintainers":[{"name":"shz","email":"lylepstein@gmail.com"}],"time":{"modified":"2022-06-19T15:27:05.747Z","created":"2011-06-01T19:27:29.236Z","0.1.6":"2011-06-01T19:27:29.537Z","0.4.0":"2011-07-02T20:28:00.358Z","0.4.1":"2011-07-02T20:31:49.156Z","0.4.2":"2011-07-18T21:23:44.774Z","0.4.3":"2014-09-17T21:02:39.600Z","0.5.0":"2014-09-22T06:47:14.712Z"},"author":{"name":"shz"},"repository":{"type":"git","url":"git@github.com:shz/node-mailgun.git"},"readme":"# node-mailgun\r\n\r\nThis library provides simple access to Mailgun's API for node.js applications.\r\nIt's MIT licensed, and being used in production over at [Hipsell](http://hipsell.com).\r\n\r\n## Installation\r\n\r\n    npm install mailgun\r\n\r\nOr you can just throw `mailgun.js` into your application.  There are\r\nno dependendies outside of node's standard library.\r\n\r\n**Note:** `master` on Github is going to be untested/unstable at times,\r\n          as this is a small enough library that I don't want to bother\r\n          with a more complicated repo structure.  As such, you should\r\n          really only rely on the version of `mailgun` in `npm`, as\r\n          I'll only ever push stable and tested code there.\r\n\r\n## Usage\r\n\r\nAt the time of writing, Mailgun's documentation is actually incorrect in places,\r\nwhich is unfortunate.  As such, I'm going to re-document everything in this README\r\naccording to the actual way it's implemented in `node-mailgun`, which itself\r\nis based off the implementation from Mailgun's github account, and not the API\r\ndocs on the site.\r\n\r\n## Initialization\r\n\r\nAccess to the API is done through a Mailgun object.  It's instantiated\r\nlike so:\r\n\r\n    var mg = new Mailgun('api-key');\r\n\r\n## Sending Email\r\n\r\nMailgun's API provides two methods for sending email: raw, and text.  Both\r\nof them are exposed here.\r\n\r\n### sendText\r\n\r\nSends a simple plain-text email.  This also allows for slightly easier\r\nsending of Mailgun options, since with `sendRaw` you have to set them\r\nin the MIME body yourself.\r\n\r\n`sendText(sender, recipients, subject, text, [servername=''], [options={}], [callback(err)])`\r\n\r\n * `sender` - Sender of the message; this should be a full email address\r\n              (e.g. `example@example.com`).\r\n * `recipients` - A string (`example@example.com`) or array of strings (`['a@example.com', 'b@example.com']`)\r\n                  of recipients; these can be email addresses *or* HTTP URLs.\r\n * `subject` - Message subject\r\n * `text` - Message body text\r\n * `servername` - The name of the Mailgun server.  If you only have\r\n                  one server on your Mailgun account, this can be omitted.\r\n                  Otherwise, it should be set to the server you want to\r\n                  send from.\r\n * `options` - Optional parameters.  See Mailgun's API docs for details on\r\n               these.  At the time of writing, the only supported value is\r\n               `headers`, which should be a hash of additional MIME headers\r\n               you want to send.\r\n * `callback` - Callback to be fired when the email is done being sent.  This\r\n                should take a single parameter, `err`, that will be set to\r\n                the status code of the API HTTP response code  if the email\r\n                failed to send; on success, `err` will be `undefined`.\r\n\r\n#### Example\r\n\r\n    sendText('sender@example.com',\r\n             ['recipient1@example.com', 'http://example.com/recipient2'],\r\n             'Behold the wonderous power of email!',\r\n             {'X-Campaign-Id': 'something'},\r\n             function(err) { err && console.log(err) });\r\n\r\n### sendRaw\r\n\r\nSends a raw MIME message.  *Don't* just use this with text; instead,\r\nyou should either build a MIME message manually or by using some MIME\r\nlibrary such as andris9's mailcomposer module https://github.com/andris9/mailcomposer \r\n(FWIW mailcomposer is the same module used by the popular nodemailer module http://github.com/andris9/Nodemailer).\r\n\r\n`sendRaw(sender, recipients, rawBody, [servername], [callback(err)])`\r\n\r\n * `sender` - Sender of the message; this should be a full email address\r\n              (e.g. `example@example.com`)\r\n * `recipients` - A string (`example@example.com`) or array of strings (`['a@example.com', 'b@example.com']`)\r\n                  of recipients; these can be email addresses *or* HTTP URLs.\r\n * `rawBody` - MIME message to send\r\n * `servername` - The name of the Mailgun server.  If you only have\r\n                  one server on your Mailgun account, this can be omitted.\r\n                  Otherwise, it should be set to the server you want to\r\n                  send from.\r\n * `callback` - Callback to be fired when the email is done being sent.  This\r\n                should take a single parameter, `err`, that will be set to\r\n                the status code of the API HTTP response code  if the email\r\n                failed to send; on success, `err` will be `undefined`.\r\n\r\n**Note:** Sending a message via raw MIME lets you use Mailgun's built-in\r\n          templating shinies.  Check out the [Mailgun Docs](http://documentation.mailgun.net/Documentation/DetailedDocsAndAPIReference#Message_Templates)\r\n          for details.\r\n\r\n#### Example\r\n\r\n    sendRaw('sender@example.com',\r\n            ['recipient1@example.com', 'http://example.com/recipient2'],\r\n            'From: sender@example.com' +\r\n              '\\nTo: ' + 'recipient1@example.com, http://example.com/recipient2' +\r\n              '\\nContent-Type: text/html; charset=utf-8' +\r\n              '\\nSubject: I Love Email' +\r\n              '\\n\\nBecause it\\'s just so awesome',\r\n            function(err) { err && console.log(err) });\r\n\r\n### Email Addresses\r\n\r\nMailgun allows sender and recipient email addresses to be formatted in\r\nseveral different ways:\r\n\r\n * `'John Doe' <john@example.com>`\r\n * `\"John Doe\" <john@example.com>`\r\n * `John Doe <john@example.com>`\r\n * `<john@example.com>`\r\n * `john@example.com`\r\n\r\n### Mailgun Headers\r\n\r\nMailgun understands a couple special headers, specified via `options` when using\r\n`sendText`, or in the MIME headers when using `sendRaw`.  These are defined\r\nbelow.\r\n\r\n * `X-Mailgun-Tag` - Used to tag sent emails (defined in `Mailgun.MAILGUN_TAG`)\r\n * `X-Campaign-Id` - Used for tracking campaign data (defined in `Mailgun.CAMPAIGN_ID`)\r\n\r\n### Example\r\n\r\nHere's a complete sending example.\r\n\r\n    var Mailgun = require('mailgun').Mailgun;\r\n\r\n    var mg = new Mailgun('some-api-key');\r\n    mg.sendText('example@example.com', ['Recipient 1 <rec1@example.com>', 'rec2@example.com'],\r\n      'This is the subject',\r\n      'This is the text',\r\n      'noreply@example.com', {},\r\n      function(err) {\r\n        if (err) console.log('Oh noes: ' + err);\r\n        else     console.log('Success');\r\n    });\r\n\r\n## Routing\r\n\r\nMailgun lets you route incoming email to different destinations.  TODO - more docs\r\n\r\n### createRoute\r\n\r\nCreates a new route.  TODO - more docs\r\n\r\n`createRoute(pattern, destination, [callback(err, id)])`\r\n\r\nTODO - document arguments\r\n\r\n### deleteRoute\r\n\r\nDeletes the route with the specified ID if it exists, otherwise fails silently.\r\n\r\n`deleteRoute(id, [callback(err)])`\r\n\r\n * id - Route ID, as returned by `getRoutes()` or `createRoute`.\r\n * Callback to be fired when the deletion is completed.  This callback\r\n   takes a single argument, `err`, that will be set to an Error object\r\n   if something went wrong with the deletion.  If the deletion succeeded, or\r\n   no route existed with the specified ID, `err` will be `undefined`.\r\n\r\n### getRoutes\r\n\r\nGets a list of all routes.\r\n\r\n`getRoutes(callback(err, routes))`\r\n\r\n * `callback` - Callback to be fired when the request has finished.  This\r\n                should take two parameters: `err`, which will hold either an\r\n                HTTP error code, or an error string on failure; and `routes`,\r\n                which will be a list of routes on success.  Routes returned\r\n                through this callback will be objects with three fields: `pattern`,\r\n                `destination`, and `id`.\r\n\r\n#### Example\r\n\r\n    getRoutes(function(err, routes) {\r\n\r\n      if (err) console.log('Error:', err);\r\n\r\n      for (var i=0; i<routes.length; i++) {\r\n        console.log('Route');\r\n        console.log('  Pattern:', routes[i].pattern);\r\n        console.log('  Destination:', routes[i].destination);\r\n        console.log('  Id:', routes[i].id);\r\n      }\r\n    });\r\n\r\n## Eventual Work:\r\n\r\n * Mailboxes\r\n\r\n","homepage":"http://github.com/shz/node-mailgun","bugs":{"url":"https://github.com/shz/node-mailgun/issues"},"readmeFilename":"readme.md","users":{"r3nya":true,"msbadar":true,"52u":true,"tverdohleb":true,"jillmolloy":true,"timbrandin":true,"roberkules":true,"goatandsheep":true,"mannieschumpert":true,"oliversalzburg":true,"quafoo":true,"rocket0191":true,"jasonwang1888":true,"miloc":true}}