Socket
Socket
Sign inDemoInstall

mailgun

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailgun - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

29

mailgun.js

@@ -26,3 +26,3 @@ //

// Dirt simple includes. Nice that we can keep things simple :)
var http = require('http'),
var https = require('https'),
querystring = require('querystring');

@@ -67,3 +67,3 @@

host: 'mailgun.net',
port: 80,
port: 443,
method: method,

@@ -98,9 +98,9 @@ path: '/api/' + resource + (servername ? '?servername=' + servername : ''),

// Pluck servername.
if (args[0] && typeof args[0] == 'string')
if (args.length && typeof args[0] == 'string')
servername = args.shift() || servername;
// Pluck options.
if (args[0] && typeof args[0] == 'object')
if (args.length && typeof args[0] == 'object')
options = args.shift() || options;
// Pluck callback.
if (args[0] && typeof args[0] == 'function')
if (args.length && typeof args[0] == 'function')
callback = args.shift() || callback;

@@ -121,5 +121,6 @@ // Don't be messy.

subject: subject,
body: text,
options: JSON.stringify(options)
body: text
});
if(options && options !== {})
body.options = JSON.stringify(options);

@@ -132,3 +133,3 @@ // Prepare our API request.

// Fire the request to Mailgun's API.
var req = http.request(httpOptions, function(res) {
var req = https.request(httpOptions, function(res) {

@@ -160,6 +161,6 @@ // If the user supplied a callback, fire it and set `err` to the

// Pluck servername.
if (args[0] && typeof args[0] == 'string')
if (args.length && typeof args[0] == 'string')
servername = args.shift() || servername;
// Pluck callback.
if (args[0] && typeof args[0] == 'function')
if (args.length && typeof args[0] == 'function')
callback = args.shift() || callback;

@@ -187,3 +188,3 @@ // Don't be messy.

// Fire it.
var req = http.request(httpOptions, function(res) {
var req = https.request(httpOptions, function(res) {

@@ -223,3 +224,3 @@ // If the user supplied a callback, fire it and set `err` to the

// Fire it.
http.request(httpOptions, function(res) {
https.request(httpOptions, function(res) {

@@ -255,3 +256,3 @@ // Collect the data

// Fire it.
http.request(httpOptions, function(res) {
https.request(httpOptions, function(res) {

@@ -282,3 +283,3 @@ if (res.statusCode == 200) {

// Fire it.
http.request(httpOptions, function(res) {
https.request(httpOptions, function(res) {

@@ -285,0 +286,0 @@ // Check for failure

{
"name": "mailgun",
"version": "0.4.2",
"version": "0.4.3",
"description": "Mailgun for Node.js",

@@ -11,4 +11,4 @@ "author": "shz",

"main": "./mailgun",
"homepage": "http://github.com/shz/mailgun",
"homepage": "http://github.com/shz/node-mailgun",
"engine": "node"
}

@@ -78,4 +78,4 @@ # node-mailgun

you should either build a MIME message manually or by using some MIME
library (I've not been able to find one for node.js -- if you're aware
of one let me know and I'll link it here).
library such as andris9's mailcomposer module https://github.com/andris9/mailcomposer
(FWIW mailcomposer is the same module used by the popular nodemailer module http://github.com/andris9/Nodemailer).

@@ -110,3 +110,3 @@ `sendRaw(sender, recipients, rawBody, [servername], [callback(err)])`

'\nSubject: I Love Email' +
'\n\nBecause it's just so awesome',
'\n\nBecause it\'s just so awesome',
function(err) { err && console.log(err) });

@@ -138,3 +138,3 @@

var mailgun = require('mailgun');
var Mailgun = require('mailgun').Mailgun;

@@ -141,0 +141,0 @@ var mg = new Mailgun('some-api-key');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc