-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail.js
31 lines (24 loc) · 851 Bytes
/
mail.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
"use strict";
import nodemailer from 'nodemailer';
import fs from "fs";
async function main() {
const transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
port: 587,
auth: {
user: '[email protected]',
pass: 'qNpxCPKn37Jk7Jcku7'
}
});
const html = fs.readFileSync('./example/test.html', 'utf8');
const info = await transporter.sendMail({
from: '"Rein Van Oyen" <[email protected]>',
to: "[email protected], [email protected]", // list of receivers
subject: "Elos test", // Subject line
text: "Elos test", // plain text body
html: html, // html body
});
console.log("Message sent: %s", info.messageId);
console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
}
main().catch(console.error);