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

@dibs-tech/mail-client

Package Overview
Dependencies
Maintainers
4
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dibs-tech/mail-client - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

43

index.js

@@ -5,2 +5,3 @@ const SparkPost = require('sparkpost');

const path = require('path');
const axios = require('axios');

@@ -140,3 +141,35 @@ require('./helpers/handlebars/classOrClasses')(handlebars);

/**
* sendCustomTemplatedEmail - Description
* @memberof MailClient
* @instance
* @param {string} recipient the recip
* @param {string} subject the subject
* @param {string} templateLink the stored template link from S3
* @param {object} data the data
* @param {object} options the options
* @param {MailClient~primaryCallback} cb the callback
*
* @returns {undefined}
*/
MailClient.prototype.sendCustomTemplatedEmail = function(recipient, subject, templateLink, data, options, cb) {
axios
.get(templateLink)
.then((result) => {
let optionsObj;
const template = handlebars.compile(result.data);
const html = template(data);
if (typeof options === 'function') {
cb = options;
optionsObj = { html };
} else {
optionsObj = { force: typeof options === 'boolean' ? options : (options.force || false), html };
if (typeof options !== 'boolean' && options.attachments) optionsObj.attachments = options.attachments;
}
this.sendEmail(recipient, subject, '', optionsObj, cb);
});
}
/**

@@ -155,3 +188,5 @@ * sendTemplatedEmail - Description

*/
MailClient.prototype.sendTemplatedEmail = function sendTemplatedEmail(recepient, subject, templateName, data, options, cb) { // eslint-disable-line max-len
MailClient.prototype.sendTemplatedEmail = function sendTemplatedEmail(recipient, subject, templateLink, data, options, cb) { // eslint-disable-line max-len
if (isCustomTemplate) return this.sendCustomTemplatedEmail(recipient, subject, templateLink, data, options, cb);
const source = fs.readFileSync(path.join(path.resolve('.'), 'email/templates/', `${templateName}.hbs`), 'utf-8');

@@ -171,5 +206,9 @@ const template = handlebars.compile(source);

this.sendEmail(recepient, subject, '', optionsObj, cb);
this.sendEmail(recipient, subject, '', optionsObj, cb);
};
// MailClient.prototype.sendCustomTemplatedEmail = async function sendCustomTemplatedEmail(recipient, subject, templateLink, data, options) {
// const template = await axios.get(templateLink);
// }
MailClient.prototype.transactions = function transactions(subject, message, options, cb) {

@@ -176,0 +215,0 @@ this.sendEmail('transactions@ondibs.com', subject, message, options, cb);

3

package.json
{
"name": "@dibs-tech/mail-client",
"version": "1.5.0",
"version": "1.5.1",
"description": "A mail client implementation, using sparkpost",

@@ -12,2 +12,3 @@ "main": "index.js",

"dependencies": {
"axios": "^0.17.1",
"fs": "0.0.1-security",

@@ -14,0 +15,0 @@ "handlebars": "^4.0.6",

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