-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmailjet.js
37 lines (37 loc) · 873 Bytes
/
mailjet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
*
* Run:
*
*/
require('dotenv/config');
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: 'makkiajamia@gmail.com',
Name: 'Me',
},
To: [
{
Email: 'shayan.dev98@gmail.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!',
},
],
})
request
.then(result => {
console.log(result.body)
})
.catch(err => {
console.log(err.statusCode)
})