# Email Setup Instructions for CloudNexus Systems ## Problem Identified The consultation booking form is not sending emails because the **OpenSSL extension is missing** from your PHP installation. This prevents SMTP connections from working properly. ## Current Status ✅ **Consultation form is working** - data is being processed correctly ❌ **Emails are not being sent** - due to missing OpenSSL extension ✅ **Temporary workaround implemented** - bookings are logged to file --- ## Solution 1: Fix OpenSSL in XAMPP (Recommended) ### Step 1: Enable OpenSSL Extension 1. Open **XAMPP Control Panel** 2. Click **"Config"** next to **Apache** 3. Select **"PHP (php.ini)"** 4. Find this line: `;extension=openssl` 5. Remove the semicolon: `extension=openssl` 6. Save the file 7. **Restart Apache** in XAMPP Control Panel ### Step 2: Verify OpenSSL is Working 1. Run this command in your project directory: ```bash php simple_email_test.php ``` 2. You should see: `✓ OpenSSL: Available` ### Step 3: Switch Back to Original Handler 1. Open `script.js` 2. Find line with: `fetch('consultation_handler_gmail.php'` 3. Change it back to: `fetch('consultation_handler.php'` 4. Save the file --- ## Solution 2: Use Gmail SMTP (Alternative) If OpenSSL still doesn't work, you can use Gmail SMTP: ### Step 1: Set Up Gmail App Password 1. Go to your Google Account settings 2. Enable 2-Factor Authentication 3. Generate an "App Password" for this application 4. Note down the 16-character password ### Step 2: Configure Gmail Handler 1. Open `email_config_gmail.php` 2. Replace these lines: ```php $this->mail->Username = 'your-gmail@gmail.com'; // Replace with your Gmail $this->mail->Password = 'your-app-password'; // Replace with Gmail App Password ``` And: ```php $this->mail->setFrom('your-gmail@gmail.com', 'CloudNexus Systems'); ``` And: ```php $companyResult = $this->sendEmail('your-email@gmail.com', $companySubject, $companyBody); ``` ### Step 3: Test Gmail Configuration 1. The system is already using `consultation_handler_gmail.php` 2. Test by submitting a consultation booking 3. Check if emails are received --- ## Solution 3: Use Hostinger SMTP with TLS (If OpenSSL works) Once OpenSSL is enabled, you can modify the original configuration: 1. Open `email_config.php` 2. Change these lines: ```php // FROM: $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; $this->mail->Port = 465; // TO: $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $this->mail->Port = 587; ``` --- ## Testing the System ### Test 1: Check PHP Extensions ```bash php simple_email_test.php ``` ### Test 2: Test Consultation Booking 1. Open your website: `http://localhost/contact.html` 2. Go to "Schedule Consultation" tab 3. Fill out the form and select a date/time 4. Click "Confirm Appointment" 5. Check for success message ### Test 3: Check Booking Logs If emails fail, check the file: `consultation_bookings.log` --- ## Current File Status ### Active Files (Temporary Setup) - `consultation_handler_gmail.php` - Current handler (logs bookings) - `email_config_gmail.php` - Gmail SMTP configuration - `script.js` - Updated to use Gmail handler ### Original Files (For when OpenSSL is fixed) - `consultation_handler.php` - Original handler - `email_config.php` - Hostinger SMTP configuration --- ## Troubleshooting ### If OpenSSL Still Doesn't Work 1. Check if `php_openssl.dll` exists in `C:\xampp\php\ext\` 2. Check if `libeay32.dll` and `ssleay32.dll` exist in `C:\xampp\php\` 3. Try reinstalling XAMPP 4. Use Solution 2 (Gmail SMTP) as permanent solution ### If Gmail SMTP Doesn't Work 1. Verify Gmail credentials are correct 2. Ensure 2FA is enabled and App Password is generated 3. Check Gmail security settings 4. Try using a different email provider ### If Bookings Aren't Being Received 1. Check browser console for JavaScript errors 2. Check `consultation_bookings.log` file 3. Verify form fields are filled correctly 4. Check server logs for PHP errors --- ## Next Steps 1. **Try Solution 1 first** (Enable OpenSSL in XAMPP) 2. **If that fails, use Solution 2** (Gmail SMTP) 3. **Test thoroughly** with real email addresses 4. **Monitor the booking logs** to ensure no bookings are lost --- *Note: The current system will log all bookings to `consultation_bookings.log` even if emails fail, so no customer inquiries will be lost.*