ShieldX's picture
Update src/config/email.js
2b765f0 verified
raw
history blame contribute delete
669 Bytes
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 };