Skip to content

WebForgeOSS/mailjet-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mailjet-wrapper

tested with jest code style: prettier

A simple and extensible Mailjet API wrapper for Node.js.

Install

$ npm install mailjet-wrapper

Usage

const MailjetWrapper = require("mailjet-wrapper");

const wrapper = new MailjetWrapper({
  apiKey: "YOUR_MAILJET_API_KEY",
  apiSecret: "YOUR_MAILJET_API_SECRET",
  dependencies: {
    mailjet: require('node-mailjet'),
    logger: console
  }
});

wrapper.send("Hello Mailjet", "This is a test email.", ["recipient@example.com"]);

API

new MailjetWrapper(config)

Creates a new instance of the MailjetWrapper.

Parameters:

Param Type Description
config Object Configuration options, including apiKey, apiSecret, and others.

wrapper.send(subject, textContent, recipients, [fromEmail], [fromName])Promise<Object>

Sends an email using the Mailjet's API.

Returns: Promise<Object> - A promise that resolves with details about the sent message.

Param Type Default Description
subject string The subject of the email.
textContent string The textual content of the email.
recipients string[] List of email addresses to send the email to.
fromEmail string "your-email@example.com" Sender's email address.
fromName string "Your Name" Sender's name.

Example:

wrapper.send("Hello Mailjet", "This is a test email.", ["recipient@example.com"]);

License

MIT © muceres

About

A simple wrapper for the Mailjet API in Node.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published