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

nodebb-plugin-emailer-mailjet

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

nodebb-plugin-emailer-mailjet - npm Package Compare versions

Comparing version 0.0.4 to 1.0.0

55

library.js

@@ -1,11 +0,8 @@

var fs = require('fs'),
path = require('path'),
var winston = module.parent.require('winston');
var Meta = module.parent.require('./meta');
winston = module.parent.require('winston'),
Meta = module.parent.require('./meta'),
var Emailer = {};
var Mailjet = require('node-mailjet');
var server;
Emailer = {},
Mailjet = require('mailjet-sendemail'),
server;
Emailer.init = function(params, callback) {

@@ -18,5 +15,3 @@ function render(req, res, next) {

if (!err && settings && settings.apiKey && settings.secretKey) {
server = new Mailjet(settings.apiKey,
settings.secretKey
);
server = Mailjet.connect(settings.apiKey, settings.secretKey);
} else {

@@ -27,3 +22,3 @@ winston.error('[plugins/emailer-mailjet] API key or SECRET Key not set!');

params.router.get('/admin/plugins/emailer-mailjet', params.middleware.admin.buildHeader, render);
params.router.get('/admin/plugins/emailer-mailjet', params.middleware.admin.buildHeader, render);
params.router.get('/api/admin/plugins/emailer-mailjet', render);

@@ -34,14 +29,32 @@

Emailer.send = function(data) {
Emailer.send = function(data, callback) {
if (!server) {
return winston.error('[emailer.mailjet] Mailjet is not set up properly!')
winston.error('[emailer.mailjet] Mailjet is not set up properly!')
return callback(null, data);
}
server.sendContent(data.from,
data.to,
data.subject,
'html',
data.html
);
var sendEmail = server.post('send');
var emailData = {
'FromEmail': data.from,
'FromName': data.from_name,
'Subject': data.subject,
'Text-part': data.plaintext,
'Html-part': data.html,
'Recipients': [{
'Email': data.to
}]
};
sendEmail
.request(emailData)
.on('success', handleSuccess)
.on('error', handleError);
function handleSuccess(data) {
callback(null, data);
}
function handleError(err) {
callback(err);
}
};

@@ -61,2 +74,2 @@

module.exports = Emailer;
module.exports = Emailer;
{
"name": "nodebb-plugin-emailer-mailjet",
"version": "0.0.4",
"description": "An emailer plugin for NodeBB using Mailjet as a third party service",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/pichalite/nodebb-plugin-emailer-mailjet"
},
"keywords": [
"nodebb",
"plugin",
"emailer",
"mailjet"
],
"author": "Pichalite <pichalite.com@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/pichalite/nodebb-plugin-emailer-mailjet/issues"
},
"homepage": "https://github.com/pichalite/nodebb-plugin-emailer-mailjet",
"dependencies": {
"path": "~0.4.9",
"mailjet-sendemail": "~1.1.4"
},
"nbbpm": {
"compatibility": "^0.6.0"
}
"name": "nodebb-plugin-emailer-mailjet",
"version": "1.0.0",
"description": "An emailer plugin for NodeBB using Mailjet as a third party service",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/pichalite/nodebb-plugin-emailer-mailjet"
},
"keywords": [
"nodebb",
"plugin",
"emailer",
"mailjet"
],
"author": "Pichalite <pichalite.com@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/pichalite/nodebb-plugin-emailer-mailjet/issues"
},
"homepage": "https://github.com/pichalite/nodebb-plugin-emailer-mailjet",
"dependencies": {
"node-mailjet": "~1.1.0"
},
"nbbpm": {
"compatibility": "^1.0.0"
}
}

@@ -9,6 +9,6 @@ {

,"hooks": [
{ "hook": "action:email.send", "method": "send" },
{ "hook": "filter:email.send", "method": "send" },
{ "hook": "filter:admin.header.build", "method": "admin.menu" },
{ "hook": "static:app.load", "method": "init" }
]
}
}

Sorry, the diff of this file is not supported yet

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