Spaces:
Running
Running
| const axios = require('axios'); | |
| require('dotenv').config(); | |
| const sendRegistrationEmail = async (userEmail, userName) => { | |
| try { | |
| const googleScriptUrl = process.env.APPSCRIPT_URL; | |
| // Send a standard HTTP POST request (Hugging Face allows this) | |
| await axios.post(googleScriptUrl, { | |
| recipientEmail: userEmail, | |
| recipientName: userName | |
| }); | |
| console.log(`📧 Google Script triggered to send email to ${userEmail}`); | |
| } catch (error) { | |
| console.error('❌ Failed to trigger Google Apps Script:', error.message); | |
| throw error; | |
| } | |
| }; | |
| module.exports = { sendRegistrationEmail }; |