ShieldX commited on
Commit
2b765f0
·
verified ·
1 Parent(s): 85fba51

Update src/config/email.js

Browse files
Files changed (1) hide show
  1. src/config/email.js +15 -16
src/config/email.js CHANGED
@@ -1,22 +1,21 @@
1
- const nodemailer = require('nodemailer');
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
- const mailOptions = {
14
- from: `"Bootcamp Admin" <${process.env.EMAIL_USER}>`,
15
- to: userEmail,
16
- subject: 'Registration Received - Web Scraping Bootcamp',
17
- text: `Hi ${userName},\n\nWe have received your registration and payment details for the Industry-Level Web Scraping Bootcamp! \n\nOur team is currently verifying your payment (and your 24-hour social media story, if you claimed the discount). We will send you another email once your dashboard is activated.\n\nGet ready to code!\n- The Bootcamp Team`
18
- };
19
- await transporter.sendMail(mailOptions);
 
 
 
 
 
 
 
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 };