-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
36 lines (33 loc) · 870 Bytes
/
test.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
const axios = require("axios");
const data = {
to: [
{
email: "[email protected]",
name: "Ajay Suresh SJ",
},
],
templateId: 1,
params: {
name: "Ajay Suresh",
surname: "SJ",
},
headers: {
"X-Mailin-custom":
"productImage:https://m.media-amazon.com/images/I/31FeKzJzVOS._SY445_SX342_QL70_ML2_.jpg",
charset: "iso-8859-1",
},
};
const headers = {
accept: "application/json",
"api-key":
"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", // Replace with your actual API key from Brevo
"content-type": "application/json",
};
axios
.post("https://api.brevo.com/v3/smtp/email", data, { headers })
.then((response) => {
console.log("Email sent successfully.");
})
.catch((error) => {
console.error("Error sending email:", error.message);
});