Spaces:
Sleeping
Sleeping
Update src/config/email.js
Browse files- src/config/email.js +15 -16
src/config/email.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
| 1 |
-
const
|
| 2 |
require('dotenv').config();
|
| 3 |
|
| 4 |
-
const transporter = nodemailer.createTransport({
|
| 5 |
-
service: 'gmail',
|
| 6 |
-
auth: {
|
| 7 |
-
user: process.env.EMAIL_USER,
|
| 8 |
-
pass: process.env.EMAIL_PASS
|
| 9 |
-
}
|
| 10 |
-
});
|
| 11 |
-
|
| 12 |
const sendRegistrationEmail = async (userEmail, userName) => {
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
};
|
| 21 |
|
| 22 |
module.exports = { sendRegistrationEmail };
|
|
|
|
| 1 |
+
const axios = require('axios');
|
| 2 |
require('dotenv').config();
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
const sendRegistrationEmail = async (userEmail, userName) => {
|
| 5 |
+
try {
|
| 6 |
+
const googleScriptUrl = process.env.APPSCRIPT_URL;
|
| 7 |
+
|
| 8 |
+
// Send a standard HTTP POST request (Hugging Face allows this)
|
| 9 |
+
await axios.post(googleScriptUrl, {
|
| 10 |
+
recipientEmail: userEmail,
|
| 11 |
+
recipientName: userName
|
| 12 |
+
});
|
| 13 |
+
|
| 14 |
+
console.log(`📧 Google Script triggered to send email to ${userEmail}`);
|
| 15 |
+
} catch (error) {
|
| 16 |
+
console.error('❌ Failed to trigger Google Apps Script:', error.message);
|
| 17 |
+
throw error;
|
| 18 |
+
}
|
| 19 |
};
|
| 20 |
|
| 21 |
module.exports = { sendRegistrationEmail };
|