Skip to content

Repository files navigation

Mail Service

A professional Mail Service Website for managing Gmail and Outlook accounts via API/SMTP/IMAP, built with native PHP (OOP), Tailwind CSS, and MySQL.

Features

  • 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

Requirements

  • PHP 8.0 or higher
  • MySQL 5.7 or higher
  • Composer
  • Node.js (for Tailwind CSS compilation)

Installation

  1. Clone the repository

    git clone <repository-url> mail
    cd mail
  2. Install PHP dependencies

    composer install
  3. Install Node.js dependencies

    npm install
  4. Configure environment

    cp .env.example .env
    # Edit .env with your database and OAuth credentials
  5. Create database

    mysql -u root -p -e "CREATE DATABASE mail_service"
    mysql -u root -p mail_service < database/schema.sql
  6. Build CSS

    npm run build
  7. Set up virtual host (or use Laragon)

Default Login

Directory Structure

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

API Usage

Authentication

Include your API key in the request header:

Authorization: Bearer your-api-key

Send Email

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>"
  }'

OAuth Setup

Gmail

  1. Go to Google Cloud Console
  2. Create a new project
  3. Enable Gmail API
  4. Create OAuth 2.0 credentials
  5. Add credentials to .env

Outlook

  1. Go to Azure Portal
  2. Register a new application
  3. Add Microsoft Graph permissions (Mail.Send, Mail.Read)
  4. Add credentials to .env

Security

  • 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 = ?)

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages