From 06336e5a5494cd5d3751b47198451286d7155fb3 Mon Sep 17 00:00:00 2001 From: Ayush Date: Fri, 8 Nov 2024 22:32:51 +0530 Subject: [PATCH 1/2] added backend to the newsletter functionality --- backend/controllers/ContactController.js | 70 +++++++++++++++++++++++ backend/controllers/image.png | Bin 0 -> 8548 bytes backend/routes/ContactRoutes.js | 2 + index.html | 44 +++++++++++++- 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 backend/controllers/image.png diff --git a/backend/controllers/ContactController.js b/backend/controllers/ContactController.js index e95f734b..04b9aefc 100644 --- a/backend/controllers/ContactController.js +++ b/backend/controllers/ContactController.js @@ -114,3 +114,73 @@ exports.suggestion = async (req, resp) => { }); } }; + +exports.newsletter = async (req, resp) => { + try { + const { email } = req.body; + + if (!email) { + return resp.status(400).json({ message: "Email is required" }); + } + + // Configure the transporter with your email credentials + const transporter = nodemailer.createTransport({ + service: "gmail", + auth: { + user: "taskmaster991@gmail.com", + pass: "kmepakzcabvztekd", + }, + }); + + const mailOptions = { + from: process.env.EMAIL_USER, + to: email, + subject: "Thank you for Subscribing to BuddyTrail", + html: ` +
+ +
+ BuddyTrail Logo +

Welcome to Our Newsletter

+
+ + +
+

Thank You for Subscribing!

+

Dear Subscriber,

+

We are thrilled to have you with us. Stay tuned for our latest updates, offers, and insights to keep you informed and inspired!

+ + +
+ + Discover More + +
+
+ + +
+

Best Regards,
BuddyTrail Team

+

© ${new Date().getFullYear()} BuddyTrail. All rights reserved.

+
+
+ `, + attachments: [ + { + filename: "buddytrail-logo.png", + path: "C:/Users/ayush/OneDrive/Desktop/BuddyTrail/backend/controllers/image.png", + cid: "headerImage", + }, + ], + }; + + // Send the email + await transporter.sendMail(mailOptions); + + resp.status(200).json({ message: "Newsletter email sent successfully!" }); + } catch (error) { + console.error("Error sending newsletter:", error); + resp.status(500).json({ message: "Error sending newsletter" }); + } +}; diff --git a/backend/controllers/image.png b/backend/controllers/image.png new file mode 100644 index 0000000000000000000000000000000000000000..881b084a4d42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RD&BPkfGWgN5IjG#HD56 zd74Bsc%<9~gPolA|M^YXne`nkX_xBy`Bv4DFFpSC>1`%AHd*ou>1MfbsmPr+_s31w zjW90Q-krz;{8G{PfmP|6Qa5REaUZSsa}O5XPZZ!3m4z)Bk7kZk7!3BNT>3t&-JKCPETKkn(ssC1ZWI9+K#*4X*J)YF@(t*cv*D%w<6Q6Zeu$m$rk ze4aSSB)FG>7#`lPS({$Kc>q^iZ_C2{nKJm$V@l7;iMU&Bvei3MlV?WW33TZHZf^+kF_@T`(xigqFfcGWfx;-6zWrR6nkuBCswx^#|K;bP zBjBhxIPRMf`5<;DXdaP;r3N#bn83XK>Fxb9gs&aX<>b)cuu-!kjXk|IbN?oEf09BN hQg}3dgM0AlIVjEH^2KJv0r1ZV6lHl0P=%aD=zo;B@2vm; literal 0 HcmV?d00001 diff --git a/backend/routes/ContactRoutes.js b/backend/routes/ContactRoutes.js index d2d45999..fd2c3273 100644 --- a/backend/routes/ContactRoutes.js +++ b/backend/routes/ContactRoutes.js @@ -5,6 +5,7 @@ const { userfeedback, sendEmail, + newsletter, suggestion, } = require("../controllers/ContactController.js"); @@ -18,4 +19,5 @@ router.post("/email", sendEmail); router.post("/suggestion", suggestion); +router.post("/newsletter", newsletter); module.exports = router; diff --git a/index.html b/index.html index 0fe7f16d..9b2890de 100644 --- a/index.html +++ b/index.html @@ -3232,12 +3232,50 @@

About Us

+