Agentic hosting is here. Connect to our MCP now
CloudLinux.ro
Applications

How to install smtp4dev on a Cloud VPS

Updated 11/29/2026

smtp4dev is a fake SMTP server for developers: your application sends its email to smtp4dev and every message lands in a web inbox instead of reaching real recipients, where you can read its content, HTML, headers and attachments, or fetch it over IMAP.

Self-hosting your development tools keeps code and project data inside your infrastructure, and the cost does not grow with the number of users.

One-click install on cloudlinux.ro

The fastest way: smtp4dev installs automatically at the first boot of a new server.

  1. Create a Cloud VPS from the control panel.
  2. In the configuration step, pick smtp4dev from the app catalog.
  3. Start the server. The install runs in the background for a few minutes and its status shows on the server page.
  4. Access details and generated passwords are saved on the server in /root/app-credentials.txt. The app will be available on port 2525.

Manual install on any Ubuntu server

If you prefer doing it yourself, below is the exact script our automatic install runs. Execute it as root on a fresh Ubuntu server (24.04 recommended). It stops at the first error, and when it finishes you will find the access details in /root/app-credentials.txt.

export DEBIAN_FRONTEND=noninteractive
cl_firewall
# Test mail from the customer's apps; only the generated login is accepted.
ufw allow 2525/tcp
curl -fsSL https://get.docker.com | sh
mkdir -p /opt/smtp4dev
cd /opt/smtp4dev
SMTP_USER=dev
SMTP_PASS=$(openssl rand -base64 24 | tr -dc 'A-Za-z0-9' | cut -c1-20)
# One login for the web inbox, SMTP and IMAP; settings locked so the
# web UI cannot switch the authentication off.
cat > .env <<ENV
ServerOptions__Urls=http://*:80
ServerOptions__HostName=${CL_HOSTNAME}
ServerOptions__LockSettings=true
ServerOptions__WebAuthenticationRequired=true
ServerOptions__AuthenticationRequired=true
ServerOptions__SmtpAllowAnyCredentials=false
ServerOptions__Users__0__Username=${SMTP_USER}
ServerOptions__Users__0__Password=${SMTP_PASS}
ServerOptions__Users__0__DefaultMailbox=Default
ServerOptions__NumberOfMessagesToKeep=1000
ServerOptions__NumberOfSessionsToKeep=200
ENV
chmod 600 .env
# Docker publishes ports past ufw: the web UI, IMAP and POP3 stay on loopback.
cat > docker-compose.yml <<'YML'
services:
  smtp4dev:
    image: rnwood/smtp4dev:v3
    restart: unless-stopped
    ports:
      - "127.0.0.1:5000:80"
      - "2525:25"
      - "127.0.0.1:1143:143"
      - "127.0.0.1:1110:110"
    env_file: .env
    volumes:
      - smtp4dev-data:/smtp4dev
volumes:
  smtp4dev-data:
YML
docker compose pull
docker compose up -d
# The inbox must answer (with the login) before we report success.
for i in $(seq 1 60); do curl -fs -o /dev/null -u "${SMTP_USER}:${SMTP_PASS}" http://127.0.0.1:5000/ && break; sleep 5; done
curl -fs -o /dev/null -u "${SMTP_USER}:${SMTP_PASS}" http://127.0.0.1:5000/
# Managed: the current v3 image every Monday at 04:00 (the messages stay in the volume).
(crontab -l 2>/dev/null; echo "0 4 * * 1 cd /opt/smtp4dev && docker compose pull -q && docker compose up -d >/dev/null 2>&1") | crontab -
{
  printf 'smtp4dev: utilizator %s, parola %s (aceleasi pentru inbox-ul web, SMTP si IMAP)\n' "$SMTP_USER" "$SMTP_PASS"
  printf 'SMTP pentru aplicatiile tale: gazda %s, portul 2525, fara TLS, autentificare PLAIN sau LOGIN cu datele de mai sus.\n' "$CL_HOSTNAME"
  printf 'Mesajele NU pleaca la destinatari reali: raman toate in inbox-ul smtp4dev (ultimele 1000).\n'
  printf 'IMAP si POP3 sunt doar locale; din calculatorul tau: ssh -L 1143:127.0.0.1:1143 root@%s, apoi IMAP pe localhost:1143.\n' "$CL_HOSTNAME"
  printf 'Configuratia este in /opt/smtp4dev/.env; imaginea se actualizeaza automat in fiecare luni la 04:00.\n'
} > /root/app-credentials.txt
cl_expose smtp4dev 5000

You can also save this script as a recipe in your account and reuse it on any new server.

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials