-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseedEmails.js
45 lines (42 loc) · 1.11 KB
/
seedEmails.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
38
39
40
41
42
43
44
45
const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
host: process.argv[2] || 'localhost',
port: process.argv[3] || 1025,
ignoreTLS: true,
});
const emails = [
{
from: "[email protected]",
to: "[email protected]",
subject: "Test Email",
text: "This is test email.",
},
{
from: "[email protected]",
to: "[email protected]",
subject: "Test Email",
text: "This is test email.",
},
{
from: "[email protected]",
to: "[email protected]",
subject: "Another test email",
text: "This is test email.",
},
{
from: "[email protected]",
to: "[email protected]",
subject: "Confirmation email",
html: "<p>This is a confirmation email.</p><a href=\"http://localhost:1080\">Click here</a>",
}
];
emails.forEach(sendEMail);
function sendEMail(item) {
transporter.sendMail(item, function (error, info) {
if (error) {
console.log(error);
} else {
console.log("Email sent: " + info.response);
}
});
}