-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (26 loc) · 789 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
// Importing nodemailer module
var nodemailer = require('nodemailer');
// authorizing the sender username and password
var transporter = nodemailer.createTransport({
service : 'gmail',
auth : {
user : '[email protected]',
pass : 'ifqo qndx tjau nnup'
}
});
// Sending message to the receiver along with the receiver's email
var message = {
from: '[email protected]',
to : '[email protected]',
subject: 'sending gmail through node.js',
html: '<h1>Welcome</h1>'
};
// sendMail() function used to send the mail to receiver along the message
transporter.sendMail(message , (error,info)=>{
if(error){
console.log(error);
}
else{
console.log('email sent ' + info.response);
}
});