A professional Mail Service Website for managing Gmail and Outlook accounts via API/SMTP/IMAP, built with native PHP (OOP), Tailwind CSS, and MySQL.
- Dashboard - Real-time email statistics with Chart.js visualizations
- Mail Providers - Connect Gmail, Outlook, or custom SMTP servers
- Email Templates - Create reusable templates with dynamic variables
- Contacts - Manage your contact list
- API System - RESTful API with key management
- API Documentation - Swagger-style documentation
- Mail Tester - Test email sending before going live
- PHP 8.0 or higher
- MySQL 5.7 or higher
- Composer
- Node.js (for Tailwind CSS compilation)
-
Clone the repository
git clone <repository-url> mail cd mail
-
Install PHP dependencies
composer install
-
Install Node.js dependencies
npm install
-
Configure environment
cp .env.example .env # Edit .env with your database and OAuth credentials -
Create database
mysql -u root -p -e "CREATE DATABASE mail_service" mysql -u root -p mail_service < database/schema.sql
-
Build CSS
npm run build
-
Set up virtual host (or use Laragon)
- Point document root to
/publicfolder - Access at: http://localhost/mail/public
- Point document root to
- Email: admin@example.com
- Password: password123
mail/
├── app/
│ ├── config/ # Configuration files
│ ├── controllers/ # Controllers
│ ├── helpers/ # Helper functions
│ ├── middleware/ # Auth & CSRF middleware
│ ├── models/ # Database models
│ └── services/ # Mail services (Gmail, Outlook, SMTP)
├── database/ # SQL schema
├── public/ # Web root (entry point)
│ └── assets/ # CSS, JS, images
├── resources/
│ ├── css/ # Tailwind source
│ └── views/ # PHP view templates
└── storage/ # Logs and cache
Include your API key in the request header:
Authorization: Bearer your-api-key
curl -X POST https://your-domain.com/api/v1/send \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"to": "recipient@example.com",
"subject": "Hello",
"body": "<h1>Hello World</h1>"
}'- Go to Google Cloud Console
- Create a new project
- Enable Gmail API
- Create OAuth 2.0 credentials
- Add credentials to
.env
- Go to Azure Portal
- Register a new application
- Add Microsoft Graph permissions (Mail.Send, Mail.Read)
- Add credentials to
.env
- Passwords are hashed with bcrypt
- CSRF protection on all forms
- SQL injection prevention with PDO prepared statements
- API credentials are encrypted before storage
- User data isolation (all queries use
WHERE user_id = ?)
MIT License