https://github.com/mailjet/mailjet-sendemail
[API v3] Node.js wrapper to send emails using Mailjet API /!\ [DEPRECATED - SEE README] /!\
https://github.com/mailjet/mailjet-sendemail
Last synced: 11 months ago
JSON representation
[API v3] Node.js wrapper to send emails using Mailjet API /!\ [DEPRECATED - SEE README] /!\
- Host: GitHub
- URL: https://github.com/mailjet/mailjet-sendemail
- Owner: mailjet
- License: mit
- Created: 2014-03-23T23:22:57.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-09-18T14:57:09.000Z (over 10 years ago)
- Last Synced: 2024-11-11T20:30:33.448Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://dev.mailjet.com
- Size: 183 KB
- Stars: 11
- Watchers: 13
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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
```bash
npm install mailjet-sendemail
```
## Initialization
Access to the API is done through a Mailjet object. It's instantiated like so:
```javascript
var Mailjet = require('mailjet-sendemail');
var mailjet = new Mailjet('apiKey', 'secretKey');
```
## Sending Email
### sendContent
Sends an email.
```javascript
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 :
```javascript
mailjet.sendContent('sender@example.com',
['recipient1@example.com', 'bcc:recipient2@example.com'],
'This is a test !',
'text',
'Well, this is working !')
```
With HTML :
```javascript
mailjet.sendContent('sender@example.com',
['recipient1@example.com', 'bcc:recipient2@example.com'],
'This is a test !',
'html',
'Well, this is working !')
```