Mailpit fungeert als centrale SMTP server voor alle PMA services in development en testing. Dit document beschrijft de configuratie en gebruik.
Mailpit biedt:
| Setting | Waarde |
|---|---|
| Host | localhost of asd-mailpit |
| Port | 1025 |
| TLS | Niet vereist |
| Auth | Niet vereist |
# grafana.ini
[smtp]
enabled = true
host = asd-mailpit:1025
skip_verify = true
from_address = grafana@pma.local
from_name = Grafana
# Environment
N8N_EMAIL_MODE: smtp
N8N_SMTP_HOST: asd-mailpit
N8N_SMTP_PORT: 1025
N8N_SMTP_SSL: false
# config/environments/production.rb
config.action_mailer.smtp_settings = {
address: 'asd-mailpit',
port: 1025
}
# configuration.yml
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: asd-mailpit
port: 1025
Toegang tot de Mailpit Web UI:
http://localhost:8025
Features:
# Lijst alle messages
curl http://localhost:8025/api/v1/messages
# Specifiek message
curl http://localhost:8025/api/v1/message/{id}
# Delete all messages
curl -X DELETE http://localhost:8025/api/v1/messages
# Search
curl "http://localhost:8025/api/v1/search?query=subject:alert"
{
"messages": [
{
"ID": "abc123",
"From": {"Address": "grafana@pma.local"},
"To": [{"Address": "admin@pma.local"}],
"Subject": "Alert: High CPU Usage",
"Date": "2024-01-15T10:30:00Z"
}
],
"total": 1
}
# Via n8n workflow
just n8n-trigger email-test
# Direct via SMTP
echo "Subject: Test" | sendmail -S localhost:1025 test@example.com
# Check Mailpit inbox
curl -s http://localhost:8025/api/v1/messages | jq '.total'
# Of open Web UI
xdg-open http://localhost:8025
Voor productie gebruik je een echte SMTP server:
# Voorbeeld met externe SMTP
SMTP_HOST: smtp.example.com
SMTP_PORT: 587
SMTP_USER: notifications@example.com
SMTP_PASSWORD: ${SMTP_PASSWORD}
SMTP_TLS: true
Tip: Gebruik environment-specifieke configuratie voor development vs productie.
| Probleem | Oorzaak | Oplossing |
|---|---|---|
| Connection refused | Mailpit niet running | just start mailpit |
| Email niet zichtbaar | Verkeerde port | Check port 1025 |
| TLS error | TLS enabled | Disable TLS voor Mailpit |
# Check Mailpit status
just status mailpit
# View logs
just logs mailpit
# Test SMTP connection
nc -zv localhost 1025