-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from mailjet/v3.1
V3.1
- Loading branch information
Showing
4 changed files
with
110 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,19 +197,19 @@ sendEmail | |
``` javascript | ||
var emailData = { | ||
'FromEmail': '[email protected]', | ||
'FromName': 'Guillaume badi', | ||
'FromEmail': '[email protected]', | ||
'FromName': 'Pilot', | ||
'Subject': 'Coucou Mailjet2', | ||
'Text-part': 'Hello World2', | ||
'Recipients': [{'Email': 'gbadi@mailjet.com'}], | ||
'Recipients': [{'Email': 'passenger@mailjet.com'}], | ||
}; | ||
var emailData2 = { | ||
'FromEmail': '[email protected]', | ||
'FromName': 'Guillaume badi', | ||
'FromEmail': '[email protected]', | ||
'FromName': 'Pilot', | ||
'Subject': 'Coucou Mailjet2', | ||
'Text-part': 'This is another Email', | ||
'Recipients': [{'Email': 'gbadi@mailjet.com'}], | ||
'Recipients': [{'Email': 'passenger@mailjet.com'}], | ||
}; | ||
sendEmail | ||
|
@@ -241,7 +241,7 @@ function newContact (email) { | |
function testEmail (text) { | ||
email = {}; | ||
email['FromName'] = 'Your Name'; | ||
email['FromEmail'] = 'Your Sender Adress'; | ||
email['FromEmail'] = 'Your Sender Address'; | ||
email['Subject'] = 'Test Email'; | ||
email['Recipients'] = [{Email: 'Your email'}]; | ||
email['Text-Part'] = text; | ||
|
@@ -261,6 +261,44 @@ testEmail('Hello World!'); | |
npm test | ||
``` | ||
|
||
## New !! Version 3.1.0 of the Nodejs wrapper ! | ||
|
||
This version modifies the way to construct the Client or the calls. We add the possibility to add an array with parameters on both Client creation and API call (please, note that each of these parameters are preset and are not mandatory in the creation or the call) : | ||
|
||
Properties of the $settings (Client constructor) and $options (API call function) | ||
|
||
url (Default: api.mailjet.com) : domain name of the API | ||
version (Default: v3) : API version (only working for Mailjet API V3 +) | ||
perform_api_call (Default: true) : turns on(true) / off the call to the API | ||
secured (Default: true) : turns on(true) / off the use of 'https' | ||
|
||
|
||
|
||
``` javascript | ||
|
||
// The third argument (the object) is not mandatory, as each of its 4 keys. | ||
const mailjet = require ('apiv3') | ||
.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE, { | ||
'url': 'api.mailjet.com', // default is the API url | ||
'version': 'v3', // default is '/v3' | ||
'secured': true, // default is a boolean true | ||
'perform_api_call': true // used for tests. default is true | ||
}) | ||
|
||
// the second argument (the object) is not mandatory, as each of its 4 keys | ||
const request = mailjet | ||
.post("send", { | ||
'url': 'api.mailjet.com', 'version': 'v3', 'secured': 'https', 'perform_api_call': false | ||
}) | ||
.request({ | ||
'FromEmail': '[email protected]', | ||
'FromName': 'Pilot', | ||
'Subject': 'Coucou Mailjet2', | ||
'Text-part': 'Hello World2', | ||
'Recipients': [{'Email': '[email protected]'}]}) | ||
|
||
``` | ||
|
||
## Contribute | ||
|
||
Mailjet loves developers. You can be part of this project! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"url": "api.mailjet.com", | ||
"version": "/v3/", | ||
"output": "json" | ||
"url": "api.mailjet.com", | ||
"version": "v3", | ||
"output": "json", | ||
"perform_api_call": true, | ||
"secured": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters