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.6 to 1.6.0

.vscode/database.json

57

index.js

@@ -22,7 +22,14 @@ const SparkPost = require('sparkpost');

*/
function MailClient() {
this.client = new SparkPost(process.env.SPARKPOST_API_KEY);
function MailClient(apiKey = process.env.SPARKPOST_API_KEY) {
this.apiKey = apiKey;
this.client = new SparkPost(apiKey);
}
Object.defineProperty(MailClient.prototype, 'sparkPostPrefix', {
get() {
return 'https://api.sparkpost.com/api/v1';
},
});
/**

@@ -180,2 +187,48 @@ * sendEmail - Description

MailClient.prototype.addEmailToTransactionalSupressionList = function addEmailToTransactionalSupressionList(email, cb) {
this.client.suppressionList.upsert({
recipient: email,
type: 'transactional'
}, cb)
}
MailClient.prototype.addEmailToNonTransactionalSupressionList = function addEmailToTransactionalSupressionList(email, cb) {
this.client.suppressionList.upsert({
recipient: email,
type: 'non_transactional'
}, cb)
}
MailClient.prototype.removeEmailFromTransactionalSupressionList = function removeEmailFromTransactionalSupressionList(email, cb) {
if (typeof cb !== 'function') cb = () => {};
axios.delete(`${this.sparkPostPrefix}/suppression-list/${email}`, {
headers: {
Authorization: this.apiKey,
Accept: 'application/json',
},
data: {
type: 'transactional'
}
}).then(response => cb(null, response.data))
.catch((err => cb(err.response.data)));
};
MailClient.prototype.removeEmailFromNonTransactionalSupressionList = function removeEmailFromNonTransactionalSupressionList(email, cb) {
if (typeof cb !== 'function') cb = () => {};
axios.delete(`${this.sparkPostPrefix}/suppression-list/${email}`, {
headers: {
Authorization: this.apiKey,
Accept: 'application/json',
},
data: {
type: 'non_transactional'
}
}).then(response => cb(null, response.data))
.catch((err => cb(err.response.data)));
};
module.exports = MailClient;

2

package.json
{
"name": "@dibs-tech/mail-client",
"version": "1.5.6",
"version": "1.6.0",
"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