Mailpit is a local SMTP testing server with web inbox UI.
flowchart LR
App([Application]) -->|:1025 SMTP| Mailpit[Mailpit]
User([User]) -->|:8025| UI[Mailpit Web UI]
- Apps send email to Mailpit SMTP port.
- Mailpit captures messages instead of sending externally.
- You inspect messages in web UI.
- Image:
axllent/mailpit:latest - SMTP:
1025 - UI:
8025 - Optional data folder:
./data:/data
cd mailpit
cp .env.example .env
docker compose up -dOpen:
- UI:
http://localhost:8025 - SMTP host/port for apps:
localhost:1025
Use these values in your application:
- SMTP host:
localhost - SMTP port:
1025 - TLS/SSL:
off(for local testing) - Username/password: usually not required in this basic setup
Use the included script:
python test-mail.pyOr run an inline quick Python test:
python - <<'PY'
import smtplib
from email.message import EmailMessage
msg = EmailMessage()
msg["Subject"] = "Mailpit Test"
msg["From"] = "dev@example.local"
msg["To"] = "user@example.local"
msg.set_content("Hello from Mailpit.")
with smtplib.SMTP("localhost", 1025) as s:
s.send_message(msg)
print("sent")
PYOpen http://localhost:8025 and check inbox:
- message list and metadata
- HTML/text body preview
- attachments and headers
docker compose ps
docker compose logs -f
docker compose downPodman equivalents:
podman compose ps
podman compose logs -f
podman compose down