Ver código fonte

Changed the logic for email engine and backend also changed the from email address to send mail

rota3015 7 meses atrás
pai
commit
ba076dab5c
1 arquivos alterados com 5 adições e 5 exclusões
  1. 5 5
      controllers/emailController.js

+ 5 - 5
controllers/emailController.js

@@ -1,5 +1,5 @@
-var db, transporter = require('../config/dbConfig');
-
+const db = require('../config/dbConfig');
+const transporter = require('../config/emailConfig');
 const mailOptions = {
     from: 'your-email@example.com', // Replace with your email address
     to: 'recipient@example.com', // Replace with the recipient's email address
@@ -20,7 +20,7 @@ exports.sendOtp = (req, res) => {
                 res.status(500).json({ success: false, message: 'Internal Server Error' });
                 return;
             }
-            sendMail(otp, email, req);
+            sendMail(otp, email, req, res);
         }
     );
 
@@ -48,9 +48,9 @@ exports.validateOtp = async (req, res) => {
     });
 };
 
-function sendMail(otp, email, req) {
+function sendMail(otp, email, req, res) {
     const mailOptions = {
-        from: 'communityrule.app@medlab.host', // Replace with your email address
+        from: 'hello@communityrule.info', // Replace with your email address
         to: email, // Replace with the recipient's email address
         subject: 'Login code for commnunityRule',
         text: 'Login code for CommunityRule: ' + otp,