1.4 KiB
1.4 KiB
Backend Setup for Contact Form
This document explains how to set up the backend for the contact form to send emails to bayan10kh@gmail.com.
Prerequisites
- PHP 7.0 or higher
- Composer (PHP dependency manager)
Installation Steps
-
Install PHPMailer via Composer:
composer install -
Configure Gmail SMTP:
- Enable 2-factor authentication on your Gmail account
- Generate an App Password for the Gmail account
- Update the
contact_handler.phpfile with your credentials:$mail->Username = 'scandrone308@gmail.com'; // Your Gmail address $mail->Password = 'your_app_password'; // Your Gmail App Password
-
Deploy the files to a PHP-enabled web server
How It Works
- The React frontend sends form data to
contact_handler.phpvia AJAX - The PHP script validates the data and sends an email using PHPMailer
- The email is sent via Gmail SMTP to bayan10kh@gmail.com
Security Notes
- Never commit your actual Gmail credentials to version control
- Use environment variables or a separate config file for sensitive data
- Ensure your App Password is kept secure
Troubleshooting
If emails aren't being sent:
- Check that Composer dependencies were installed correctly
- Verify your Gmail credentials and App Password
- Ensure your hosting provider allows SMTP connections
- Check the server error logs for more details