Configuration

Environment Variables

Cleanmails is configured entirely through environment variables. These are set in your .env file (located at /opt/cleanmails/.env after installation).

MASTER_KEY is required in production

The MASTER_KEY must be exactly 16, 24, or 32 characters. It's used for AES encryption of passwords and tokens. Generate with: openssl rand -hex 16

Core Settings

VariableDefaultDescription
APP_ENVdevelopmentSet to production for production deployments
ADDR:8080Server listen address (auto-switches to :80 in production)
MASTER_KEYRequired. AES encryption key (16/24/32 chars)
SITE_URLhttp://localhost:8080Public URL of your instance (used for tracking links)
PUBLIC_DIR./publicPath to the frontend static files
TRUST_PROXYfalseTrust X-Forwarded-For header (set true behind Caddy/Nginx)

SMTP Verification

VariableDefaultDescription
SMTP_FROM_EMAILuser@example.orgMAIL FROM address for SMTP checks
SMTP_HELO_NAMElocalhostHELO/EHLO hostname for SMTP checks
SMTP_CONNECT_TIMEOUT10sTCP connection timeout
SMTP_OPERATION_TIMEOUT10sSMTP command timeout
SMTP_CATCH_ALLtrueEnable catch-all detection
LOCAL_IPSComma-separated IPs for rotation

Validation Engine

VariableDefaultDescription
MAX_EMAILS100000Max emails per bulk request
LEVEL1_CONCURRENCY1000Concurrent Level 1 checks
LEVEL2_CONCURRENCY100Concurrent Level 2 (SMTP) checks
JOB_CONCURRENCY200Default workers per bulk job
VALIDATION_RATE20.0Emails/second rate limit for SMTP checks
RATE_JITTER0.1Random jitter (±10%) on rate limit
RESULT_TTL15mHow long bulk results are kept in memory
STORE_RESULTStrueStore results for later retrieval

Outreach Workers

VariableDefaultDescription
OUTREACH_WORKERS50Number of concurrent email sending workers
OUTREACH_BUFFER5000Task queue buffer size
OUTREACH_BATCH_SIZE100Leads processed per campaign tick
VALIDATION_WORKERS20Workers for list validation
VALIDATION_BUFFER50000Validation task queue size

Mail Server (Mailcow/docker-mailserver)

VariableDefaultDescription
MAILCOW_URLMailcow API URL (or docker-exec for docker-mailserver)
MAILCOW_KEYMailcow API key (or docker-exec)
MAILCOW_SMTP_HOSTlocalhostSMTP host for internal mailboxes
MAILCOW_IMAP_HOSTlocalhostIMAP host for reply checking
MAIL_HOSTNAMEmail.localhostMail server hostname (for HELO, rDNS)

AI & Warmup

VariableDefaultDescription
AI_RATE_LIMIT10Gemini API calls per second
WARMUP_REPLY_MIN_DELAY5mMin delay before warmup auto-reply
WARMUP_REPLY_MAX_DELAY30mMax delay before warmup auto-reply

HTTP & Security

VariableDefaultDescription
READ_TIMEOUT30sHTTP read timeout
WRITE_TIMEOUT30sHTTP write timeout
MAX_REQUEST_BODY_MB10Max request body size in MB
BLACKLIST_CHECK_INTERVAL4hHow often to check IP blacklists