-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsendCode.js
More file actions
32 lines (27 loc) · 729 Bytes
/
sendCode.js
File metadata and controls
32 lines (27 loc) · 729 Bytes
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
const nodemailer = require("nodemailer");
const handlebars = require("handlebars");
const fs = require("fs");
const path = require("path");
const sendCode = async (email, verify, code) => {
let transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'macrotracker7@gmail.com',
pass: 'czbhgnaegyjelzpd'
}
});
var mailOptions = {
from: 'macrotracker7@gmail.com',
to: email,
subject: verify,
text: 'This is your code for ' + verify + ': ' + code
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
};
module.exports = sendCode;