This project allows users to send emails via SMTP server using PHP and the PHPMailer library. It features a clean Bootstrap UI and uses SweetAlert2 for better user experience.
✔ Send emails via SMTP 📧
✔ CSRF protection for security 🔐
✔ SweetAlert2 for user notifications 💡
✔ Responsive UI with Bootstrap 🎨
✔ AJAX support for seamless requests ⚡
1️⃣ User fills out the email form and submits.
2️⃣ JavaScript fetch API sends data to send-mail.php
.
3️⃣ PHP backend validates data, checks CSRF token, and sends an email using PHPMailer.
4️⃣ SweetAlert2 displays a success/failure notification.
/project-root
│── /src/images/logo.svg # Project logo
│── /vendor # Composer dependencies
│── index.php # Frontend
│── send-mail.php # Backend logic for sending emails
│── composer.json # Composer configuration
│── README.md # Documentation
1️⃣ Clone the repository:
git clone https://github.com/Iqbolshoh/php-send-mail.git
2️⃣ Navigate to the project directory:
cd php-mailer
3️⃣ Install dependencies via Composer:
composer install
4️⃣ Configure your SMTP settings in send-mail.php
:
// SMTP Server Configuration
define('SMTP_HOST', 'mail.yourdomain.com');
define('SMTP_USER', 'your-email@yourdomain.com');
define('SMTP_PASS', 'your-email-password');
define('SMTP_PORT', 465); // 465 for SSL, 587 for TLS
5️⃣ Run the project on a local server:
php -S localhost:8000
6️⃣ Open your browser and go to:
http://localhost:8000/
🎯 Contributions are welcome! If you have suggestions or want to enhance the project, feel free to fork the repository and submit a pull request.
💬 I love meeting new people and discussing tech, business, and creative ideas. Let’s connect! You can reach me on these platforms: