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

@techie04/xpresser-mailer

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@techie04/xpresser-mailer - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

3

package.json
{
"name": "@techie04/xpresser-mailer",
"version": "0.1.6",
"version": "0.2.0",
"description": "Mailer Plugin for xpresser",

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

"dependencies": {
"abolish": "^4.7.0",
"nodemailer": "^6.7.0"

@@ -19,0 +20,0 @@ },

@@ -10,23 +10,21 @@ "use strict";

const index_1 = require("../index");
const abolish_1 = require("abolish");
// -------- Creating a provider. ---------
const SmtpProvider = new MailProvider_1.MailProvider("smtp", {
initialize(config) {
// Remove null or undefined values.
config.removeNullOrUndefined();
// Check for required keys.
for (const val of ["host", "port", "username", "password", "fromEmail"]) {
if (!config.get(val)) {
throw new Error(`Mailer smtp config: {${val}} is missing!`);
}
}
/**
* Validate Config Object
*/
const [err] = abolish_1.Abolish.validate(config.data, {
// all is required and must be typeof string
"*": "required|typeof:string",
host: { $name: "{host}" },
port: { $name: "{port}", typeof: false },
"auth.user": { $name: "{auth.user}" },
"auth.pass": { $name: "{auth.pass}" }
});
if (err)
throw new Error(`Smtp Config: ${err.message}`);
// Return client.
return nodemailer_1.default.createTransport({
host: config.get("host"),
port: config.get("port"),
...(config.get("port") === 465 ? { secure: true } : { secure: false }),
auth: {
user: config.get("username"),
pass: config.get("password")
}
});
return nodemailer_1.default.createTransport(config.data);
},

@@ -33,0 +31,0 @@ sendMail({ mail, client, config }) {

@@ -45,8 +45,10 @@ # XpresserJs Mailer Plugin

configs: {
// Smtp config inherits nodemailers's config.
smtp: {
host: "", // SMTP Server Host
port: "", // SMTP Server Port
username: "", // SMTP Server Username
password: "", // SMTP Server Password
fromEmail: "no-reply@example.com" // From email
auth: {
user: "", // SMTP Server Username
pass: "", // SMTP Server Password
}
},

@@ -53,0 +55,0 @@

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