-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (30 loc) · 776 Bytes
/
app.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
const nodemailer = require('nodemailer');
const cron = require('node-cron');
require('dotenv').config();
const mailOptions = {
from: process.env.from ,
to: process.env.to ,
subject: "Email from nodeJs NodeMailer App",
text: "HELLO FROM NODE USING DOTENV"
};
const transporter = nodemailer.createTransport({
service: 'gmail',
auth:{
user: process.env.from,
pass: process.env.pass
}
});
// cron.schedule('* * * * * * ', () =>{
// console.log("hello bro")
// });
//send email
cron.schedule(' * * * * * *', () => {
transporter.sendMail(mailOptions, (error, info) => {
if(error){
console.log(error)
}
else{
console.log("Email Send " + info.response)
}
});
});