Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loopback-connector-mailgun

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopback-connector-mailgun - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

34

lib/mailgun.js

@@ -84,4 +84,4 @@ var Mailgun = require('mailgun-js'),

mailgunMessage.subject = options.subject || null;
mailgunMessage.html = options.html || null;
mailgunMessage.text = options.text || null;
mailgunMessage.html = options.html || '';
mailgunMessage.text = options.text || '';
if (options.replyTo){

@@ -91,2 +91,32 @@ mailgunMessage['h:Reply-To'] = options.replyTo;

if (options.attachments){
mailgunMessage.attachment = [];
if (lo.isString(options.attachments)){
mailgunMessage.attachment.push(options.attachments);
} else if (lo.isArray(options.attachments)){
for (var i in options.attachments){
mailgunMessage.attachment.push(options.attachments[i]);
mailgunMessage['h:encoding'] = 'multipart/form-data';
}
}
}
if (options.options){
lo.forEach(options.options,function (value,key) {
mailgunMessage['o:' + key] = value;
});
}
if (options.var){
lo.forEach(options.var,function (value,key) {
mailgunMessage['v:' + key] = value;
});
}
if (options.headers){
lo.forEach(options.headers,function (value,key) {
mailgunMessage['h:' + key] = value;
});
}
connector.mailgun.messages().send(mailgunMessage, function (err,body) {

@@ -93,0 +123,0 @@ fn(null, body);

2

package.json
{
"name": "loopback-connector-mailgun",
"version": "0.0.4",
"version": "0.0.5",
"description": "Loopback connector module which allow to send emails via Mailgun",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -53,5 +53,16 @@ ## loopback-connector-mailgun

text: "text message",
html: "html <b>message</b>"
html: "html <b>message</b>",
attachments : [path.resolve('../client/images/an-image.jpg'))],
var : {
myVar1 : 'a custom value'
},
headers : {
"X-My-Header" : "My Custom header"
}
})
.then(function(response){})
.catch(function(err){});
.catch(function(err){});
###quick note on attachments
Refer to Mailgun documentation on limitations concerning attachments.
The attachments property can be either an array or a string.
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