Last active
April 10, 2019 14:26
-
-
Save Nikola-Andreev/4a6dc343bac3c01e8f0223e07270546f to your computer and use it in GitHub Desktop.
node-mailjet #78
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
const mailjet = require('node-mailjet'); | |
require('dotenv').config(); | |
async function main() { | |
const mailjet = require ('node-mailjet').connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE); | |
const request = mailjet | |
.post("send", {'version': 'v3.1'}) | |
.request({ | |
"Messages":[ | |
{ | |
"From": { | |
"Email": "xxxexample1@mail.com", | |
"Name": "Me" | |
}, | |
"To": [ | |
{ | |
"Email": "example1@mail.com", | |
"Name": "You" | |
} | |
], | |
"Subject": "My first Mailjet Email!", | |
"TextPart": "Greetings from Mailjet!", | |
"HTMLPart": "<h3>Dear passenger 1, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!</h3><br />May the delivery force be with you!" | |
} | |
] | |
}) | |
let result = await request; | |
console.log(result); // Error: Unsuccessful: 403 Forbidden | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment