mailjet-sendemail
v1.1.4
Published
Sends email using Mailjet API via Node.js
Downloads
134
Readme
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.
[email protected]
). - to - A string ([email protected]) or array of strings (['[email protected]', '[email protected]']) of recipients. For cc and bcc support, append cc: or bcc: to the recipient email address (cc:[email protected]).
- 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('[email protected]',
['[email protected]', 'bcc:[email protected]'],
'This is a test !',
'text',
'Well, this is working !')
With HTML :
mailjet.sendContent('[email protected]',
['[email protected]', 'bcc:[email protected]'],
'This is a test !',
'html',
'<b>Well, this is working !</b>')