shubs / Mailjet-sendemail

Node.js wrapper to send emails using Mailjet API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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);
  • from - Sender of the message; this should be a full email address (e.g. example@example.com).
  • to - A string (example@example.com) or array of strings (['a@example.com', 'b@example.com']) of recipients. For cc and bcc support, append cc: or bcc: to the recipient email address (cc:example@example.com).
  • subject - Message subject
  • type - The type of the email, 'text' or 'html'
  • content - Message content, depending on the type

Examples

With plain text :

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

With HTML :

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

About

Node.js wrapper to send emails using Mailjet API

License:MIT License


Languages

Language:JavaScript 100.0%