A simple and extensible Mailjet API wrapper for Node.js.
$ npm install mailjet-wrapper
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"]);Creates a new instance of the MailjetWrapper.
Parameters:
| Param | Type | Description |
|---|---|---|
| config | Object |
Configuration options, including apiKey, apiSecret, and others. |
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"]);MIT © muceres