-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.js
34 lines (26 loc) · 951 Bytes
/
service.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
import brevo from "@getbrevo/brevo";
const apiInstance = new brevo.TransactionalEmailsApi();
apiInstance.setApiKey(
brevo.TransactionalEmailsApiApiKeys.apiKey,
process.env.BREVO_API_KEY
);
async function sendEmail() {
try {
const sendSmtpEmail = new brevo.SendSmtpEmail();
sendSmtpEmail.subject = "Hello, World!";
sendSmtpEmail.to = [
{ email: "[email protected]", name: "Infinity xD" },
];
sendSmtpEmail.htmlContent =
"<html><body><h1>Hello, world!</h1><p>This is a test email</p><a href='https://github.com/SkivaDev'>Go to my repository</a></body></html>";
sendSmtpEmail.sender = {
name: "SkivaDev",
email: "[email protected]",
};
const result = await apiInstance.sendTransacEmail(sendSmtpEmail);
console.log(result);
} catch (error) {
console.log(error);
}
}
sendEmail();