forked from 100devs/todo-mvc-auth-local
-
Notifications
You must be signed in to change notification settings - Fork 3
/
nodemailer.js
33 lines (27 loc) · 1.06 KB
/
nodemailer.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
const nodemailer = require('nodemailer')
require('dotenv').config({path: './config/.env'})
const transporter = nodemailer.createTransport({
// host: 'smtp.ethereal.email',
service: "hotmail",
// port: 587,
// secure: false,
auth: {
user: 'node-todo-list@outlook.com',
pass: process.env.PASS
}
})
exports.sendMail = function(sendTo, taskDue){
const msg = {
from: '"Due List" <node-todo-list@outlook.com>', // Sender address
to: `${sendTo}`, // List of receivers
subject: "Due Date Notification", // Subject line
text: `Hello! This is an email to notify you that the task "${taskDue}" is due in 5 days!`, // Plain text body
}
transporter.sendMail(msg, function(err, info) {
if(err){
console.log(err)
return
}
console.log("Sent email to: " + msg.to)
})
}