This commit is contained in:
noot
2024-01-30 15:58:31 +08:00
4 changed files with 22 additions and 69 deletions

View File

@ -62,7 +62,6 @@ async function sendTokenEmail(email, token) {
<p>EcoSaver Team</p>
<p><a href="https://ecosaver.teeseng.uk/">EcoSaver Website</a></p>
<p>Please do not reply to this email.</p>
`,
});
transporter.sendMail({ tokenMessage }, function (error, info) {
@ -77,19 +76,19 @@ async function sendTokenEmail(email, token) {
}
}
async function sendResetPasswordEmail(email, message) {
console.log(email, message);
async function sendResetPasswordEmail(email, link, resetToken) {
console.log(email);
try {
let resetMessage = await transporter.sendMail({
to: process.env.euser,
to: email,
from: process.env.euser,
subject: "Reset Password",
html: `
<h1>Reset Password</h1>
<p><strong>Reset Password Link:</strong> ${link}</p>
<p><strong>One time token:</strong> ${resetToken}</p>
<p><strong>From:</strong> Eco Saver</p>
<p><strong>User Email:</strong> ${email}</p>
<p><strong>Message:</strong> ${message}</p>
<p>Kindly click on the link given to reset your password!</p>
<p>Kindly click on the link and key in the one time token given to reset your password!</p>
<p>Regards,</p>
<p>EcoSaver Team</p>
<p><a href="https://ecosaver.teeseng.uk/">EcoSaver Website</a></p>
@ -108,36 +107,4 @@ async function sendResetPasswordEmail(email, message) {
}
}
async function sendResetTokenEmail(email, token) {
try {
let tokenMessage = await transporter.sendMail({
to: email,
from: process.env.euser,
subject: "API Token",
html: `
<h1>API Token</h1>
<p><strong>Token:</strong> ${token}</p>
<p>Please do not lose this token and do not share your token with anyone!</p>
<p>Thank you for using EcoSaver.</p>
<p>Regards,</p>
<p>EcoSaver Team</p>
<p><a href="https://ecosaver.teeseng.uk/">EcoSaver Website</a></p>
<p>Please do not reply to this email.</p>
`,
});
transporter.sendMail({ resetMessage }, function (error, info) {
if (error) {
console.log(error);
} else {
console.log("Email sent: " + info.response);
}
});
} catch (error) {
console.error(error);
}
}
module.exports = { sendContactEmail , sendTokenEmail, sendResetPasswordEmail, sendResetTokenEmail };
module.exports = { sendContactEmail , sendTokenEmail, sendResetPasswordEmail };