Skip to content

Commit

Permalink
finally done
Browse files Browse the repository at this point in the history
  • Loading branch information
Shouraya committed Oct 9, 2020
1 parent 180575e commit fd037df
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
15 changes: 11 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require('dotenv').config();

const nodemailer = require('nodemailer');
// const hbs = require('nodemailer-express-handlebars')
const hbs = require('nodemailer-express-handlebars');

//Step 1

Expand All @@ -13,15 +13,22 @@ let transporter = nodemailer.createTransport({
}
});

transporter.use('compile', hbs({
viewEngine: "express-handlebars",
viewPath: "./",
extName: ".handlebars"
}));

//Step 2

let mailOptions = {
from: 'shourayagoyal2406@gmail.com',
from: 'shourayagoyal2000@gmail.com',
to: '[email protected], [email protected]',
// cc: ''
// bcc: ''
subject: 'Testing and Testing',
text: 'IT works'
text: 'IT works',
template: 'main'
};

//Step 3
Expand All @@ -31,5 +38,5 @@ transporter.sendMail(mailOptions)
console.log('Email Sent !!');
})
.catch(function(error) {
console.log('Error: ' error);
console.log('Error: ' ,error);
});
16 changes: 16 additions & 0 deletions main.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
h1 {
color: blue;
}
</style>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fd037df

Please sign in to comment.