In my node web application, i used nodemailer to sent emails.
.then(user => {
const mailOptions = {
from: "Mohammad.front.dev@gmail.com",
to: user.email,
subject: "Reset Password",
html: `
<html>
<head>
<meta charset="utf-8" />
<style>
body, * {
direction: ltr;
}
</style>
</head>
<body>
<h1>You've requested a password reset!</h1>
<h3>
Click this <a href="http://localhost:8000/new-password/${token}">Link</a> to set a new password.
</h3>
<body>
</html>
`
};
req.flash("info", "Checkout your email for reset password link.");
res.redirect("/products");
transporter.sendMail(mailOptions, (error, info) => {
if(error) console.log(error);
else console.log(info);
});
...
I want to send a html reversed file instead of writing all that stuff in a js file. How do i do this?
You can just read the content from the HTML file to the variable and use this variable in mailOptions
Similar questions: