From b7fd54ab31e5ef42b36c5764c4a0c64af9bdebfe Mon Sep 17 00:00:00 2001 From: Ujjwal Saini Date: Mon, 14 Oct 2024 23:08:01 +0530 Subject: [PATCH] Deployment Success --- Backend/api/index.js | 5 -- Backend/api/send-email.js | 46 ----------------- src/pages/Home.js | 2 +- src/pages/SweetEmail.js | 103 -------------------------------------- 4 files changed, 1 insertion(+), 155 deletions(-) delete mode 100644 Backend/api/index.js delete mode 100644 Backend/api/send-email.js diff --git a/Backend/api/index.js b/Backend/api/index.js deleted file mode 100644 index 3014b1d..0000000 --- a/Backend/api/index.js +++ /dev/null @@ -1,5 +0,0 @@ -// api/index.js -export default function handler(req, res) { - res.status(200).json({ message: 'API is running' }); - } - \ No newline at end of file diff --git a/Backend/api/send-email.js b/Backend/api/send-email.js deleted file mode 100644 index 45c7d5e..0000000 --- a/Backend/api/send-email.js +++ /dev/null @@ -1,46 +0,0 @@ -const nodemailer = require('nodemailer'); - -export default async function handler(req, res) { - if (req.method === 'POST') { - const { email } = req.body; - - if (!email) { - return res.status(400).json({ success: false, message: 'Email is required' }); - } - - // Set up nodemailer transporter - const transporter = nodemailer.createTransport({ - service: 'gmail', // You can use another service like SendGrid or SMTP - auth: { - user: 'saini.ujjwals007@gmail.com', - pass: 'pnot bnpc cfwp wnyx', - }, - }); - - const mailOptions = { - from: 'saini.ujjwals007@gmail.com', // Your email - to: email, - subject: 'Congratulations! You’ve Successfully Subscribed to Daily Bhagavad Gita Shlokas!', - text: `You have successfully subscribed to daily Bhagavad Gita Shlokas! Congratulations! 🎉 - -Get ready to dive deep into the profound wisdom and teachings of the Bhagavad Gita. Each day, you will receive a meaningful Shloka delivered straight to your inbox. These sacred verses will guide you on a spiritual journey, offering insights into life, duty, and inner peace. - -Enjoy the daily dose of timeless philosophy and find inspiration from the divine teachings of Lord Krishna. 🌿 - -We are excited to have you with us on this path of spiritual growth!` - }; - - try { - const info = await transporter.sendMail(mailOptions); - console.log('Email sent:', info.response); - return res.status(200).json({ success: true, message: 'Email sent successfully!' }); - } catch (error) { - console.error('Error sending email:', error); - return res.status(500).json({ success: false, message: 'Failed to send email', error }); - } - } else { - // Handle other HTTP methods - res.setHeader('Allow', ['POST']); - return res.status(405).end(`Method ${req.method} Not Allowed`); - } -} diff --git a/src/pages/Home.js b/src/pages/Home.js index faac1e0..f741a2a 100644 --- a/src/pages/Home.js +++ b/src/pages/Home.js @@ -3,7 +3,7 @@ import { Link } from "react-router-dom"; import AOS from 'aos'; import './home.css'; -import EmailPusher from './EmailPusher'; +// import EmailPusher from './EmailPusher'; import { AudioPlayer } from 'react-audio-play'; import SweetEmailPusher from './SweetEmail'; import song from '../components/FluteTunes/krishnaflute.mp3'; diff --git a/src/pages/SweetEmail.js b/src/pages/SweetEmail.js index 9b30aef..89ef9f1 100644 --- a/src/pages/SweetEmail.js +++ b/src/pages/SweetEmail.js @@ -104,106 +104,3 @@ const styles = { }; export default EmailPusher; - - - -// Todo: Not having Node Mailer - Else perfect -// import React, { useState } from "react"; -// import Swal from "sweetalert2"; - -// const isMobile = window.innerWidth <= 768; -// const EmailPusher = () => { -// const promptForEmail = async () => { -// try { -// const { value: email } = await Swal.fire({ -// title: "Input Email Address", -// input: "email", -// inputLabel: "Your Email Address", -// inputPlaceholder: "Enter your email address" -// }); - -// if (email) { -// Swal.fire(`Entered Email: ${email}`); -// } else { -// Swal.fire("No email entered."); -// } -// } catch (error) { -// console.error("Error capturing email:", error); -// Swal.fire("An error occurred while capturing your email."); -// } -// }; - -// return ( -//
-//

-// Want Daily Bhagvat Geeta Shlok's!
Enter your email below: -//

-//
-//
-// -// U Subscribed! -// -// -// -// -// -// Subscribe -// -// Subscription -//
-//
-//
-// ); -// }; - -// const styles = { -// container: { -// display: "flex", -// flexDirection: "column", -// alignItems: "center", -// justifyContent: "center", -// height: "30vh", // Slightly larger height for more room -// padding: "20px", -// borderRadius: "15px", -// marginTop: isMobile ? "0" : "-3.5rem", -// marginLeft: isMobile ? "0" : "4rem", -// maxWidth: "600px", // Limit the width for large screens -// }, -// description: { -// fontSize: "1.5rem", -// color: "#333", -// marginBottom: "20px", -// textAlign: "center", -// fontWeight: "bold", -// textShadow: "2px 2px 4px rgba(0, 0, 0, 0.3)", -// }, -// form: { -// display: "flex", -// flexDirection: "column", -// alignItems: "center", -// width: "100%", -// }, -// // Media queries for responsiveness -// "@media (max-width: 768px)": { -// container: { -// padding: "10px", // Adjust padding for smaller screens -// height: "auto", // Allow flexible height for small screens -// }, -// description: { -// fontSize: "1.25rem", // Smaller font size on mobile -// }, -// }, -// }; - -// export default EmailPusher;