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.3 to 1.5.4

helpers/validators/isURL.js

43

index.js

@@ -141,35 +141,2 @@ const SparkPost = require('sparkpost');

/**
* 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 sendCustomTemplatedEmail(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);
});
}
/**
* sendTemplatedEmail - Description

@@ -187,4 +154,6 @@ * @memberof MailClient

*/
MailClient.prototype.sendTemplatedEmail = function sendTemplatedEmail(recipient, subject, templateName, data, options, cb) { // eslint-disable-line max-len
const source = fs.readFileSync(path.join(path.resolve('.'), 'email/templates/', `${templateName}.hbs`), 'utf-8');
MailClient.prototype.sendTemplatedEmail = async function sendTemplatedEmail(recipient, subject, templateName, data, options, cb) { // eslint-disable-line max-len
// check if templateName is a link
const templateIsCustom = isURL(templateName);
const source = templateIsCustom ? (await axios.get(templateName)).data : fs.readFileSync(path.join(path.resolve('.'), 'email/templates/', `${templateName}.hbs`), 'utf-8');
const template = handlebars.compile(source);

@@ -206,6 +175,2 @@ const html = template(data);

// 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) {

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

{
"name": "@dibs-tech/mail-client",
"version": "1.5.3",
"version": "1.5.4",
"description": "A mail client implementation, using sparkpost",

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

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