File size: 669 Bytes
2b765f0
3c21989
 
 
2b765f0
 
 
 
 
 
 
 
 
 
 
 
 
 
3c21989
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 };