-
Notifications
You must be signed in to change notification settings - Fork 418
/
Copy pathmailer.js
25 lines (23 loc) · 930 Bytes
/
mailer.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
const nodemailer = require("nodemailer");
// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport({
host: process.env.EMAIL_SMTP_HOST,
port: process.env.EMAIL_SMTP_PORT,
//secure: process.env.EMAIL_SMTP_SECURE, // lack of ssl commented this. You can uncomment it.
auth: {
user: process.env.EMAIL_SMTP_USERNAME,
pass: process.env.EMAIL_SMTP_PASSWORD
}
});
exports.send = function (from, to, subject, html)
{
// send mail with defined transport object
// visit https://nodemailer.com/ for more options
return transporter.sendMail({
from: from, // sender address e.g. no-reply@xyz.com or "Fred Foo 👻" <foo@example.com>
to: to, // list of receivers e.g. bar@example.com, baz@example.com
subject: subject, // Subject line e.g. 'Hello ✔'
//text: text, // plain text body e.g. Hello world?
html: html // html body e.g. '<b>Hello world?</b>'
});
};