forked from CSI-KJSCE/Travel-policy-
Add Dark Mode, Password Hashing for better security , Settings Page, Policy PDF in Policy section,UI Changes
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import nodeMailer from 'nodemailer';
|
||||
|
||||
export default async function sendMail({ emailId, link, type, status, designation }) {
|
||||
if (!process.env.TravelPolicyEmail || !process.env.TravelPolicyEmailPass) {
|
||||
return;
|
||||
}
|
||||
export default async function sendMail({
|
||||
emailId,
|
||||
link,
|
||||
type,
|
||||
status,
|
||||
designation,
|
||||
}) {
|
||||
// Check if we have email password in env
|
||||
if (!process.env.TravelPolicyEmail || !process.env.TravelPolicyEmailPass) {
|
||||
console.log("No email password found in .env, so I can't send emails.");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("parametrs", emailId, link, type, status, designation);
|
||||
|
||||
@@ -48,20 +56,20 @@ export default async function sendMail({ emailId, link, type, status, designatio
|
||||
<a href=${link}>View Application</a>
|
||||
<p>Thank you.</p>
|
||||
`,
|
||||
};
|
||||
break;
|
||||
case 'accounts':
|
||||
mailOptions = {
|
||||
from: process.env.TravelPolicyEmail,
|
||||
to: emailId,
|
||||
subject: 'Transfer money to the applicant',
|
||||
html: `
|
||||
<p>Please transfer the travel policy amount to the applicant's account. Click on the link below to view the application:</p>`
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error('Invalid email type');
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "accounts":
|
||||
mailOptions = {
|
||||
from: process.env.TravelPolicyEmail,
|
||||
to: emailId,
|
||||
subject: "Transfer money to the applicant",
|
||||
html: `
|
||||
<p>Please transfer the travel policy amount to the applicant's account. Click on the link below to view the application:</p>`,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new Error("Invalid email type");
|
||||
}
|
||||
|
||||
try {
|
||||
await transporter.sendMail(mailOptions);
|
||||
|
||||
Reference in New Issue
Block a user