diff --git a/server/Controllers/OtherController.js b/server/Controllers/OtherController.js index 42445b0..8a0466c 100644 --- a/server/Controllers/OtherController.js +++ b/server/Controllers/OtherController.js @@ -21,36 +21,69 @@ const subscribeNewsletter = async (req, res) => { await newSubscriber.save(); // Configure the transporter + // const transporter = nodemailer.createTransport({ + // service: "gmail", + // auth: { + // user: process.env.EMAIL_USER, // Use environment variables in production + // pass: process.env.EMAIL_PASS, + // }, + // }); const transporter = nodemailer.createTransport({ service: "gmail", auth: { - user: process.env.EMAIL_USER, // Your email - pass: process.env.EMAIL_PASS, // Your email password (use environment variables in production) + user: "taskmaster991@gmail.com", // Your email + pass: "kmepakzcabvztekd", // Your email password }, }); - const mailOptions = { from: "anujverma3553@gmail.com", - to: email, + to: email, // Send confirmation email to the subscriber's email subject: "Thank you for Subscribing to Our Newsletter", html: ` -
-

Thank You for Subscribing!

-

Dear Subscriber,

-

We are thrilled to have you with us. Stay tuned for our latest updates and offers!

- +
+ +
+ Welcome +

Thank You for Subscribing!

+
+ + +
+

Welcome to the BitBox Community!

+

+ Dear Subscriber, +

+

+ We’re thrilled to have you with us. Get ready to stay updated with the latest trends and offers. +

+ +
Explore More -

Best Regards,
BitBox Team

- `, + + +
+

Best Regards,
BitBox Team

+

Follow us on our social channels for more updates

+
+
+ `, + attachments: [ + { + filename: "bitbox", + path: "Controllers/assests/bitboximage.png", + cid: "welcomeImage", + }, + ], }; // Send the confirmation email await transporter.sendMail(mailOptions); - res.status(200).json({ message: "Subscription successful, confirmation email sent" }); + res + .status(200) + .json({ message: "Subscription successful, confirmation email sent" }); } catch (error) { console.error("Error in subscribing to newsletter:", error.message); res.status(500).json({ message: error.message }); diff --git a/server/Controllers/assests/bitboximage.png b/server/Controllers/assests/bitboximage.png new file mode 100644 index 0000000..f8a50b5 Binary files /dev/null and b/server/Controllers/assests/bitboximage.png differ