forked from goitacademy/nodejs-homework-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlala.js
More file actions
32 lines (27 loc) · 596 Bytes
/
lala.js
File metadata and controls
32 lines (27 loc) · 596 Bytes
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
import nodemailer from "nodemailer";
import "dotenv/config";
const { MAIL_API_KEY, MAIL_FROM } = process.env;
const nodemailerConfig = {
host: "smtp.ukr.net",
port: 465,
secure: true,
auth: {
user: MAIL_API_KEY,
pass: MAIL_FROM,
},
};
const transport = nodemailer.createTransport(nodemailerConfig);
const email = {
from: MAIL_API_KEY,
to: "email address for who",
subject: "topic of the letter",
html: "<stron>Hi!</stron>",
};
transport
.sendMail(email)
.then(() => {
console.log("Email sent!");
})
.catch((err) => {
console.log(err.message);
});