الملفات
ScanDrone/README_BACKEND.md
2025-10-28 22:04:46 +03:00

46 أسطر
1.4 KiB
Markdown

# 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
1. PHP 7.0 or higher
2. Composer (PHP dependency manager)
## Installation Steps
1. Install PHPMailer via Composer:
```bash
composer install
```
2. Configure Gmail SMTP:
- Enable 2-factor authentication on your Gmail account
- Generate an App Password for the Gmail account
- Update the `contact_handler.php` file with your credentials:
```php
$mail->Username = 'scandrone308@gmail.com'; // Your Gmail address
$mail->Password = 'your_app_password'; // Your Gmail App Password
```
3. Deploy the files to a PHP-enabled web server
## How It Works
1. The React frontend sends form data to `contact_handler.php` via AJAX
2. The PHP script validates the data and sends an email using PHPMailer
3. 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:
1. Check that Composer dependencies were installed correctly
2. Verify your Gmail credentials and App Password
3. Ensure your hosting provider allows SMTP connections
4. Check the server error logs for more details