Skip to content

Configuration ​

MXHook is configured via environment variables or CLI flags. CLI flags take precedence over environment variables.

Environment Variables ​

VariableCLI FlagDefaultDescription
MXHOOK_SMTP_ADDR--smtp-addr0.0.0.0:2525SMTP server listen address
MXHOOK_SMTP_DOMAIN--smtp-domainlocalhostSMTP server hostname (used in HELO/EHLO)
MXHOOK_API_ADDR--api-addr0.0.0.0:8080REST API listen address
MXHOOK_POSTGRES_DSN--db-url—PostgreSQL connection string (required)
MXHOOK_API_KEY--api-key—API authentication key. If empty, API is unauthenticated
CF_QUEUE_ACCOUNT_ID——Cloudflare account ID (for Cloudflare Queue backend)
CF_QUEUE_ID——Cloudflare queue ID
CF_QUEUE_TOKEN——Cloudflare API token

Example .env File ​

bash
# SMTP
MXHOOK_SMTP_ADDR=0.0.0.0:25
MXHOOK_SMTP_DOMAIN=mail.yourdomain.com

# API
MXHOOK_API_ADDR=0.0.0.0:8080
MXHOOK_API_KEY=your-secret-api-key

# Database
MXHOOK_POSTGRES_DSN=postgres://mxhook:mxhook@localhost:5432/mxhook?sslmode=require

SMTP Limits ​

LimitDefaultDescription
Max message size10 MBMaximum size of a single email message
Max recipients50Maximum number of recipients per message
Rate limit100 msgs/hour per IPInbound rate limiting

PostgreSQL ​

MXHook requires PostgreSQL 14 or later. The connection string follows the standard libpq format:

postgres://user:password@host:port/database?sslmode=disable

MXHook automatically creates the required tables on first startup. No manual migration is needed.

Queue Backend ​

By default, MXHook uses PostgreSQL as its message queue (recommended for most deployments). For edge/serverless deployments, you can use Cloudflare Queues by setting the CF_QUEUE_* variables.

Released under the Apache 2.0 License.