From 082e2271111de04b9b7f5749b1a761eb5f8bcf2b Mon Sep 17 00:00:00 2001 From: Kailasdevdas Date: Mon, 27 Apr 2026 17:29:33 +0530 Subject: [PATCH] feat: improve email template --- .../academicsResearch.controller.js | 73 ++++++++++++++-- .../src/controllers/appointment.controller.js | 87 +++++++++++++++++-- .../src/controllers/candidate.controller.js | 83 +++++++++++++++--- backend/src/controllers/inquiry.controller.js | 64 ++++++++++++-- 4 files changed, 273 insertions(+), 34 deletions(-) diff --git a/backend/src/controllers/academicsResearch.controller.js b/backend/src/controllers/academicsResearch.controller.js index e89edb3..d1a51f9 100644 --- a/backend/src/controllers/academicsResearch.controller.js +++ b/backend/src/controllers/academicsResearch.controller.js @@ -35,18 +35,73 @@ export const createAcademicsResearch = async (req, res) => { to: emailList, subject: "New Academics & Research Inquiry", html: ` -

New Academics & Research Inquiry

+
+ +
+ + +
+

GG Hospital

+

+ New Academics & Research Inquiry +

+
-

Name: ${fullName}

-

Phone: ${number}

-

Email: ${emailId || "-"}

+ +
+ +

Contact Details

+ + + + + + + + + + + + + + + + + + + + + + +
Name:${fullName}
Phone:${number}
Email:${emailId || "-"}
Course:${courseName || "-"}
Subject:${subject || "-"}
-

Course: ${courseName || "-"}

-

Subject: ${subject || "-"}

+ +
+

Message

+
+ ${message ? message.replace(/\n/g, "
") : "-"} +
+
-

Message:

-

${message || "-"}

- `, +
+ + +
+ This message was sent from the GG Hospital website (Academics & Research Inquiry). +
+ +
+ +
+ `, }); } } catch (err) { diff --git a/backend/src/controllers/appointment.controller.js b/backend/src/controllers/appointment.controller.js index f8e50a5..df316ca 100644 --- a/backend/src/controllers/appointment.controller.js +++ b/backend/src/controllers/appointment.controller.js @@ -38,15 +38,84 @@ export const createAppointment = async (req, res) => { to: emailList, subject: "New Appointment Booked", html: ` -

New Appointment Booked

-

Name: ${name}

-

Phone: ${mobileNumber}

-

Email: ${email || "-"}

-

Doctor: ${appointment.doctor?.name}

-

Department: ${appointment.department?.name}

-

Date: ${new Date(date).toLocaleDateString()}

-

Message: ${message || "-"}

- `, +
+ +
+ + +
+

GG Hospital

+

+ New Appointment Booked +

+
+ + +
+ +

Patient Details

+ + + + + + + + + + + + + + +
Name:${name}
Phone:${mobileNumber}
Email:${email || "-"}
+ +

Appointment Details

+ + + + + + + + + + + + + + +
Doctor:${appointment.doctor?.name || "-"}
Department:${appointment.department?.name || "-"}
Date: + ${new Date(date).toLocaleDateString()} +
+ + +
+

Message

+
+ ${message ? message.replace(/\n/g, "
") : "-"} +
+
+ +
+ + +
+ This appointment was booked via the GG Hospital website. +
+ +
+ +
+ `, }); } } catch (err) { diff --git a/backend/src/controllers/candidate.controller.js b/backend/src/controllers/candidate.controller.js index b87f053..dc86722 100644 --- a/backend/src/controllers/candidate.controller.js +++ b/backend/src/controllers/candidate.controller.js @@ -39,19 +39,82 @@ export const createCandidate = async (req, res) => { to: emailList, subject: "New Job Application Received", html: ` -

New Candidate Application

+
+ +
+ + +
+

GG Hospital

+

+ New Job Application Received +

+
-

Name: ${fullName}

-

Phone: ${mobile}

-

Email: ${email}

+ +
+ +

Candidate Details

+ + + + + + + + + + + + + + +
Name:${fullName}
Phone:${mobile}
Email:${email}
-

Applied For: ${candidate.career?.post || "-"}

-

Designation: ${candidate.career?.designation || "-"}

+

Application Details

-

Subject: ${subject || "-"}

-

Cover Letter:

-

${coverLetter || "-"}

- `, + + + + + + + + + + + + + +
Applied For:${candidate.career?.post || "-"}
Designation:${candidate.career?.designation || "-"}
Subject:${subject || "-"}
+ + +
+

Cover Letter

+
+ ${coverLetter ? coverLetter.replace(/\n/g, "
") : "-"} +
+
+ +
+ + +
+ This application was submitted via the GG Hospital careers page. +
+ +
+ +
+ `, }); } } catch (err) { diff --git a/backend/src/controllers/inquiry.controller.js b/backend/src/controllers/inquiry.controller.js index 474de9e..1648d07 100644 --- a/backend/src/controllers/inquiry.controller.js +++ b/backend/src/controllers/inquiry.controller.js @@ -32,14 +32,66 @@ export const createInquiry = async (req, res) => { to: emailList, subject: "New Inquiry Received", html: ` -

New Inquiry

+
+ +
+ + +
+

GG Hospital

+

New Inquiry Received

+
-

Name: ${fullName}

-

Phone: ${number}

-

Email: ${emailId}

+ +
+ +

Contact Details

+ + + + + + + + + + + + + + + + + + +
Name:${fullName}
Phone:${number}
Email:${emailId}
Subject:${subject}
-

Subject: ${subject}

-

Message: ${message}

+ +
+

Message

+
+ ${message ? message.replace(/\n/g, "
") : "-"} +
+
+ +
+ + +
+ This message was sent from the GG Hospital website contact form. +
+ +
+ +
`, }); }