Self-Hosted

InstallLaravel Mail

Deploy the complete email marketing platform on your own infrastructure with Docker Compose in minutes. No SaaS fees, no limits — full control over your data.

0 What You Get

Laravel Mail is a self-hosted, open-source email marketing platform built with Laravel. When you install it, you get the entire stack running on your server — no data leaves your infrastructure.

Email Marketing Engine

  • Unlimited contacts and lists
  • Drag-and-drop email builder
  • Campaign scheduling and automation
  • Open/click tracking and analytics

Multi-Channel Messaging

Also available with Laravel Social platform

  • WhatsApp Business API integration
  • Facebook Messenger automation
  • Instagram DM automation
  • Gmail inbox management

AI-Powered Features

  • Local Ollama AI integration
  • AI subject line generation
  • Autonomous lead scoring agents
  • Content generation (all on-device)

Infrastructure & Security

  • GDPR-compliant, full data ownership
  • KumoMTA high-performance SMTP
  • Multi-tenant workspaces
  • White-label and custom domains

1 System Requirements

Your server needs to meet these minimum requirements to run Laravel Mail. Docker handles PHP, Node.js, and all dependencies inside containers — you don't need to install them on the host.

RAM

2 GB minimum

Recommended: 4 GB+

More RAM improves queue processing speed

CPU

2 vCPU minimum

Recommended: 4 vCPU+

AI features (Ollama) need more cores

Disk

20 GB minimum

Recommended: 50 GB+ SSD

MySQL and Mailpit store data locally

OS

Linux (amd64)

Recommended: Ubuntu 22.04+

Docker works best on Linux kernels

Cloud Provider Examples

DigitalOcean Basic Droplet ($12/mo, 2 GB RAM), AWS t3.small ($15/mo, 2 GB RAM), Hetzner CX21 (€4.85/mo, 2 GB RAM), or any VPS with 2+ GB RAM running Ubuntu 22.04+. For AI features with Ollama, use 4 GB+ RAM.

2 Supported Operating Systems

Docker works on all major platforms, but we recommend Linux for production deployments.

Ubuntu 22.04 / 24.04 LTS

Recommended for production. Best Docker support and stability.

Debian 12 / Rocky Linux 9

Enterprise-grade alternatives with long-term support.

macOS / Windows (Dev Only)

Works for local development. Not recommended for production.

3 Prerequisites — What You Need to Install

Before installing Laravel Mail, make sure your server has the following software installed. Docker handles PHP, Node, MySQL, and Redis inside containers — you only need Docker and Git on the host.

Install Docker Engine

Docker runs all services (PHP, MySQL, Redis, etc.) in isolated containers. Install the official Docker Engine and Docker Compose plugin.

# Ubuntu / Debian
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

# Verify installation
docker --version
docker compose version

Install Git

Git is used to clone the Laravel Mail repository.

# Ubuntu / Debian
sudo apt update && sudo apt install git -y

# Verify
git --version

Install Make (optional but recommended)

Make provides simple commands like make build and make prod to manage your installation.

# Ubuntu / Debian
sudo apt install make -y

4 Firewall & Port Configuration

Open the required ports in your server firewall. If you're using a cloud provider (AWS, GCP, DigitalOcean), also configure the security group / firewall rules.

Required Ports

5210 Application (HTTP)
5211 Application (Alt)
5173 Vite Dev Server
2525 KumoMTA (SMTP)
25 SMTP (Standard)
1025 Mailpit SMTP
8025 Mailpit Web UI
3306 MySQL
6378 Redis
8086 phpMyAdmin

UFW Firewall Commands

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 5210/tcp
sudo ufw allow 25/tcp
sudo ufw allow 2525/tcp
sudo ufw enable

5 Installation Steps

Follow these steps to get Laravel Mail running. The entire process takes about 5-10 minutes depending on your server speed and internet connection.

1

Clone the repository

Download the Laravel Mail source code to your server.

git clone https://github.com/laravelmail/app.laravelmail.com.git
cd app.laravelmail.com
2

Configure environment variables

Copy the example env file and customize it for your setup. At minimum, set your APP_URL, database credentials, and mail settings.

cp .env.example .env
3

Build and start all containers

Docker builds the application image and starts all 5 services.

make build && make prod
4

Run database migrations and seed

Create all database tables and populate default data (admin user, settings, etc.).

make migrate && make seed
5

Access your application

Open your browser and navigate to your server IP or domain on port 5210.

http://your-server-ip:5210

6 Environment Variables Reference

These are the key variables in your .env file. Most have sensible defaults — you only need to change a few for production.

Variable Example
APP_NAME Laravel Mail
APP_URL https://app.example.com
APP_KEY base64:...
DB_HOST mysql
DB_DATABASE laravel
DB_USERNAME laravel
DB_PASSWORD laravel_password
REDIS_HOST redis
REDIS_PASSWORD redis_password
MAIL_MAILER smtp
MAIL_HOST mailpit
MAIL_PORT 1025
MAIL_FROM_ADDRESS noreply@example.com
MAIL_FROM_NAME Laravel Mail

7 Docker Compose Configuration

This is the full Docker Compose config. It defines 5 services: the Laravel app, MySQL, Redis, Mailpit (email testing), and phpMyAdmin. All data is persisted via Docker volumes.

docker-compose.yaml
services:
  app.laravelmail.com:
    build:
      context: .
      dockerfile: Dockerfile
    image: izdrail/app.laravelmail.com:latest
    container_name: app.laravelmail.com
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    ports:
      - '5210:5210'
      - '5211:5211'
      - '5173:5173'
      - '2525:2525'
      - '25:25'
    volumes:
      - './:/var/www'
      - './.env:/var/www/.env'
    networks:
      - sail
    depends_on:
      - mysql
      - mailpit
      - redis

  redis:
    image: redis:alpine
    container_name: redis
    restart: unless-stopped
    command: redis-server --requirepass redis_password
    ports:
      - '6378:6379'
    volumes:
      - redis_data:/data
    networks:
      - sail

  mysql:
    image: mysql:8.0
    container_name: mysql
    restart: unless-stopped
    ports:
      - '3306:3306'
    environment:
      MYSQL_DATABASE: laravel
      MYSQL_USER: laravel
      MYSQL_PASSWORD: laravel_password
      MYSQL_ROOT_PASSWORD: root_password
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - sail

  mailpit:
    image: axllent/mailpit
    container_name: mailpit
    restart: unless-stopped
    ports:
      - '1025:1025'
      - '8025:8025'
    environment:
      MP_MAX_MESSAGES: 5000
      MP_DATABASE: /data/mailpit.db
      MP_SMTP_AUTH_ACCEPT_ANY: 1
      MP_SMTP_AUTH_ALLOW_INSECURE: 1
    volumes:
      - mailpit_data:/data
    networks:
      - sail

  phpmyadmin:
    container_name: phpmyadmin-laravel
    ports:
      - '8086:80'
    depends_on:
      - mysql
    environment:
      PMA_HOST: mysql
      PMA_USER: root
      PMA_PASSWORD: root_password
    image: phpmyadmin/phpmyadmin
    networks:
      - sail
    restart: unless-stopped

volumes:
  mysql_data:
    driver: local
  mailpit_data:
    driver: local
  redis_data:
    driver: local

networks:
  sail:
    driver: bridge

8 Available Make Commands

Use these shortcuts to manage your installation. All commands run inside the Docker containers.

make build Build the Docker image for production
make prod Start all containers in production mode
make down Stop and remove all containers
make restart Restart all containers
make rebuild Full rebuild: stop, build, start, migrate, seed, and clear caches
make shell Access the application container's bash shell
make logs Tail the application container logs
make migrate Run database migrations
make seed Seed the database
make test Run PHPUnit tests
make lint Run PHP CodeSniffer linting
make fix-lint Auto-fix linting issues
make clear-cache Clear all Laravel caches (views, routes, config, cache)
make clean-queue Clear the Horizon queue
make prune Prune unused Docker resources
make clean Full cleanup: remove containers, images, and volumes

9 Post-Installation Checklist

After installation, verify everything is working and complete these steps before going live.

Verify all containers are running

Run docker ps — you should see 5 containers (app, mysql, redis, mailpit, phpmyadmin).

Test email sending

Send a test email from the dashboard. Check Mailpit at http://localhost:8025 to see captured emails.

Configure your domain and SSL

Point your domain DNS to the server IP. Use Certbot or a reverse proxy (Nginx/Caddy) for HTTPS.

Set up DNS for email sending

Configure SPF, DKIM, and DMARC DNS records for your sending domain to improve deliverability.

Change default passwords

Update MySQL root password, Redis password, and create your admin account with a strong password.

Set up automated backups

Configure daily MySQL dumps and Docker volume backups to external storage (S3, Backblaze, etc.).

10 Troubleshooting

Common issues and how to fix them.

Port 25 already in use

Another SMTP server (Postfix, Sendmail) is running on port 25.

sudo systemctl stop postfix
sudo systemctl disable postfix

Containers keep restarting

Check the logs for the specific error.

make logs

Database connection refused

MySQL might not be ready yet. Wait a few seconds and try again, or restart the app container.

make restart

Cannot access port 5210 externally

Check your cloud provider's firewall / security group. The port must be open for inbound TCP traffic.

sudo ufw status

11 Services Included

Laravel Mail runs 6 Docker containers out of the box. Each handles a specific part of the stack.

Laravel Mail App

The main application running PHP 8.3, Node.js for asset compilation, and Supervisor for queue workers. Accessible on port 5210.

MySQL 8.0

Primary relational database. Stores contacts, campaigns, templates, and all application data. Persistent volume storage.

Redis

In-memory store for caching, session management, and queue broker for Horizon (Laravel's queue dashboard).

Mailpit

Fake SMTP server for development. Captures all outgoing emails and displays them in a web UI on port 8025.

phpMyAdmin

Web-based database management tool. Access MySQL directly at port 8086 for debugging and data management.