mailjet / Mailjet-sendemail

[API v3] Node.js wrapper to send emails using Mailjet API /!\ [DEPRECATED - SEE README] /!\
https://dev.mailjet.com
MIT License
11 stars 6 forks source link

Warning:

This wrapper is deprecated

use: https://github.com/mailjet/mailjet-apiv3-nodejs instead

mailjet-sendemail

This library permits to send emails using Mailjet's API in Node.js. It's MIT licensed.

Installation

npm install mailjet-sendemail

Initialization

Access to the API is done through a Mailjet object. It's instantiated like so:

var Mailjet = require('mailjet-sendemail');
var mailjet = new Mailjet('apiKey', 'secretKey');

Sending Email

sendContent

Sends an email.

mailjet.sendContent(from, to, subject, type, content);

Examples

With plain text :

mailjet.sendContent('sender@example.com',
         ['recipient1@example.com', 'bcc:recipient2@example.com'],
         'This is a test !',
         'text',
         'Well, this is working !')

With HTML :

mailjet.sendContent('sender@example.com',
         ['recipient1@example.com', 'bcc:recipient2@example.com'],
         'This is a test !',
         'html',
         '<b>Well, this is working !</b>')