Deploying an AnonAddy App
Introduction
AnonAddy (now branded as addy.io) is a powerful open-source anonymous email forwarding service. It allows you to create unlimited aliases that forward to your real email address, protecting your privacy and helping you identify who sells your data. Key features include:
- Unlimited email aliases – create aliases on-the-fly using your username subdomain or custom domains
- GPG/OpenPGP encryption – encrypt forwarded emails with your public key
- Reply anonymously – respond from aliases without revealing your real address
- Custom domains – use your own domains for professional-looking aliases
- Browser extensions & mobile apps – generate aliases from anywhere
Built with Laravel (PHP 8.2+), MySQL/MariaDB, Redis, and Postfix, AnonAddy is ideal for privacy-conscious users who want full control over their email forwarding infrastructure.
Deploying AnonAddy on Klutch.sh gives you automated builds from GitHub, managed secrets, persistent storage for DKIM keys and user data, plus the flexibility to configure SMTP relay for outbound email delivery.
Architecture overview
AnonAddy requires several components working together:
| Component | Purpose | Klutch.sh deployment |
|---|---|---|
| Laravel app (PHP 8.2+) | Web UI and API | Main HTTP app on port 8000 |
| MySQL/MariaDB | User accounts, aliases, domains | Separate TCP app or external database |
| Redis | Queues and rate limiting | Separate TCP app or external service |
| Postfix | Inbound/outbound SMTP | Built into the official Docker image |
| Rspamd (optional) | Spam filtering and DKIM signing | Built into the official Docker image |
The official AnonAddy Docker image bundles the Laravel app, Postfix, and optional Rspamd into a single container, exposing:
- Port 8000 – HTTP (web interface)
- Port 25 – SMTP (mail server)
- Port 11334 – Rspamd web dashboard (optional)
Important: AnonAddy requires port 25 for receiving and sending email. Many cloud providers block this port. You may need to request port 25 to be unblocked or use an SMTP relay service for outbound mail.
Prerequisites
Before deploying AnonAddy on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub repository (fork of the official AnonAddy Docker repo or your own with a Dockerfile)
- A domain name you control with access to DNS settings
- A MySQL/MariaDB database (deploy on Klutch.sh or use a managed service)
- A Redis instance (deploy on Klutch.sh or use a managed service)
- Basic understanding of DNS records (MX, SPF, DKIM, DMARC)
- (Optional) An SMTP relay service (SendGrid, Mailgun, Amazon SES) for reliable outbound delivery
Deployment steps
-
Prepare your GitHub repository
Fork or clone the official AnonAddy Docker repository:
Terminal window git clone https://github.com/anonaddy/docker.git anonaddy-dockercd anonaddy-dockergit remote set-url origin https://github.com/YOUR_USERNAME/anonaddy-docker.gitgit push -u origin masterThe repository already contains a production-ready Dockerfile. Klutch.sh automatically detects the Dockerfile in the repository root and uses it for building—no manual selection is required.
Alternatively, create a minimal Dockerfile that references the official image:
FROM anonaddy/anonaddy:latest# The official image handles everything# Just ensure environment variables are configured in Klutch.sh -
Deploy MySQL on Klutch.sh (or use external database)
AnonAddy requires MySQL or MariaDB for storing user accounts, aliases, and domain configurations.
Option A: Deploy MySQL on Klutch.sh
- In klutch.sh/app, create a new app for MySQL.
- Connect a GitHub repository with a MySQL Dockerfile:
FROM mysql:8ENV MYSQL_DATABASE=anonaddyENV MYSQL_USER=anonaddyENV MYSQL_PASSWORD=your-secure-passwordENV MYSQL_ROOT_PASSWORD=your-root-passwordEXPOSE 3306- Select TCP traffic and set the internal port to 3306.
- Attach a persistent volume with mount path
/var/lib/mysqland size 20 GB. - Deploy the app. Connect to it at
your-mysql-app.klutch.sh:8000.
Option B: Use a managed MySQL service
Use a managed database like PlanetScale, Amazon RDS, or Google Cloud SQL. Note the connection details for environment variable configuration.
-
Deploy Redis on Klutch.sh (or use external service)
Redis is used for queues and rate limiting.
- Create a new app for Redis in klutch.sh/app.
- Use a simple Redis Dockerfile:
FROM redis:7-alpineEXPOSE 6379CMD ["redis-server", "--appendonly", "yes"]- Select TCP traffic and set the internal port to 6379.
- Optionally attach a persistent volume at
/datawith size 5 GB for AOF persistence. - Deploy the app. Connect at
your-redis-app.klutch.sh:8000.
-
Create the AnonAddy app on Klutch.sh
- Log in to klutch.sh/app.
- Create a new project (if needed) by clicking New Project.
- Inside your project, click New App.
- Connect your GitHub repository containing the AnonAddy Dockerfile.
- Klutch.sh will detect the Dockerfile automatically and begin building.
-
Configure environment variables
In the Klutch.sh dashboard, navigate to your AnonAddy app’s Settings → Environment Variables. Add the following variables, marking sensitive values as secrets.
Required variables:
Terminal window # TimezoneTZ=UTC# User/Group IDs (match your container setup)PUID=1000PGID=1000# ApplicationAPP_KEY=base64:YOUR_GENERATED_APP_KEYAPP_URL=https://example-app.klutch.shAPP_DEBUG=false# AnonAddy specificANONADDY_DOMAIN=example.comANONADDY_HOSTNAME=mail.example.comANONADDY_SECRET=your-long-random-secret-string# Database (adjust based on your MySQL deployment)DB_HOST=your-mysql-app.klutch.shDB_PORT=8000DB_DATABASE=anonaddyDB_USERNAME=anonaddyDB_PASSWORD=your-database-password# Redis (adjust based on your Redis deployment)REDIS_HOST=your-redis-app.klutch.shREDIS_PORT=8000# Mail configurationMAIL_FROM_NAME=AnonAddyMAIL_FROM_ADDRESS=addy@example.comGenerate APP_KEY:
Run this command locally to generate a Laravel app key:
Terminal window echo "base64:$(openssl rand -base64 32)"Optional variables:
Terminal window # Admin user (receives emails at root domain)ANONADDY_ADMIN_USERNAME=admin# Registration controlANONADDY_ENABLE_REGISTRATION=true# Additional domains (comma-separated)ANONADDY_ALL_DOMAINS=example.com,mail.example.com# LimitsANONADDY_LIMIT=200ANONADDY_BANDWIDTH_LIMIT=104857600ANONADDY_NEW_ALIAS_LIMIT=10ANONADDY_ADDITIONAL_USERNAME_LIMIT=10# Postfix relay (for outbound email via SMTP relay)POSTFIX_RELAYHOST=[smtp.sendgrid.net]:587POSTFIX_RELAYHOST_AUTH_ENABLE=truePOSTFIX_RELAYHOST_USERNAME=apikeyPOSTFIX_RELAYHOST_PASSWORD=your-sendgrid-api-keyPOSTFIX_SMTP_TLS=encrypt# Rspamd (enable for DKIM signing and spam filtering)RSPAMD_ENABLE=true# DKIMANONADDY_DKIM_SELECTOR=default -
Configure the internal port
In your AnonAddy app’s settings:
- Select HTTP traffic for the web interface.
- Set the internal port to 8000.
Note on SMTP: The official AnonAddy Docker image also exposes port 25 for SMTP. Klutch.sh HTTP routing handles the web interface, but for full email functionality you may need to configure an SMTP relay for outbound mail or work with your provider regarding port 25 access for inbound mail.
-
Attach persistent storage
AnonAddy requires persistent storage for DKIM keys, GnuPG keys, and application data.
- Navigate to Storage in your app’s settings.
- Click Add Volume.
- Configure:
- Mount path:
/data - Size: 20 GB (adjust based on expected usage)
- Mount path:
- Save the volume.
The
/datadirectory stores:- DKIM private/public keys (
/data/dkim/) - GnuPG keys for email signing (
/data/.gnupg/) - Application storage and logs
-
Deploy the application
- Push any final changes to your GitHub repository.
- In the Klutch.sh dashboard, click Deploy (or trigger a redeploy).
- Monitor the build logs for any errors.
- Once complete, your AnonAddy instance will be available at
https://example-app.klutch.sh.
-
Configure DNS records
For AnonAddy to receive email, configure the following DNS records for your domain:
MX Record:
Type: MXHost: @Value: mail.example.com (or your Klutch.sh app hostname)Priority: 10SPF Record:
Type: TXTHost: @Value: v=spf1 mx -allDKIM Record:
After deployment, generate DKIM keys using the container’s built-in command (via Klutch.sh console):
Terminal window gen-dkimThis creates
/data/dkim/example.com.privateand/data/dkim/example.com.txt. Add the contents of the.txtfile as a DNS TXT record:Type: TXTHost: default._domainkeyValue: v=DKIM1; k=rsa; p=YOUR_PUBLIC_KEY...DMARC Record:
Type: TXTHost: _dmarcValue: v=DMARC1; p=quarantine; adkim=s; aspf=s; -
Create your first user
Use the Klutch.sh console to create an admin user:
Terminal window anonaddy anonaddy:create-user "yourusername" "your-email@example.com"Follow the prompts to set a password. You can then log in at
https://example-app.klutch.sh. -
Verify the deployment
- Open
https://example-app.klutch.shin your browser. - Log in with the user you created.
- Create a test alias.
- Send an email to the alias and verify it forwards correctly.
- Test replying from an alias to confirm outbound email works.
- Open
Environment variables reference
| Variable | Default | Description |
|---|---|---|
TZ | UTC | Container timezone |
PUID / PGID | 1000 | User/group IDs for file permissions |
APP_KEY | — | Laravel encryption key (required) |
APP_URL | — | Public URL of your installation |
ANONADDY_DOMAIN | — | Primary domain for email aliases (required) |
ANONADDY_HOSTNAME | — | FQDN for the mail server |
ANONADDY_SECRET | — | Secret for hashing anonymous reply data (required) |
ANONADDY_ADMIN_USERNAME | — | Username that receives emails at root domain |
ANONADDY_ENABLE_REGISTRATION | true | Allow new user registrations |
DB_HOST | — | MySQL hostname (required) |
DB_PORT | 3306 | MySQL port |
DB_DATABASE | anonaddy | Database name |
DB_USERNAME | anonaddy | Database user |
DB_PASSWORD | — | Database password |
REDIS_HOST | — | Redis hostname |
REDIS_PORT | 6379 | Redis port |
POSTFIX_RELAYHOST | — | SMTP relay server (e.g., [smtp.sendgrid.net]:587) |
RSPAMD_ENABLE | false | Enable Rspamd for DKIM signing and spam filtering |
Persistent storage paths
| Mount path | Purpose | Recommended size |
|---|---|---|
/data | DKIM keys, GnuPG keys, app storage | 20 GB |
/var/lib/mysql (MySQL app) | Database files | 20–50 GB |
/data (Redis app) | AOF persistence | 5 GB |
Sample Dockerfile
If you want to customize the official image, here’s a reference Dockerfile:
FROM anonaddy/anonaddy:latest
# The base image includes:# - PHP 8.2 with required extensions# - Nginx# - Postfix mail server# - Rspamd (optional spam filtering)# - s6-overlay process supervisor
# Environment variables are configured via Klutch.sh dashboard# Data is persisted to /data volume
# Ports exposed:# - 8000: HTTP (web interface)# - 25: SMTP (mail server)# - 11334: Rspamd dashboard
# No additional configuration needed for basic deploymentsUsing an SMTP relay for outbound email
Many cloud environments block port 25. To ensure reliable outbound email delivery, configure an SMTP relay service:
SendGrid:
POSTFIX_RELAYHOST=[smtp.sendgrid.net]:587POSTFIX_RELAYHOST_AUTH_ENABLE=truePOSTFIX_RELAYHOST_USERNAME=apikeyPOSTFIX_RELAYHOST_PASSWORD=SG.your-sendgrid-api-keyPOSTFIX_SMTP_TLS=encryptMailgun:
POSTFIX_RELAYHOST=[smtp.mailgun.org]:587POSTFIX_RELAYHOST_AUTH_ENABLE=truePOSTFIX_RELAYHOST_USERNAME=postmaster@your-domain.mailgun.orgPOSTFIX_RELAYHOST_PASSWORD=your-mailgun-smtp-passwordPOSTFIX_SMTP_TLS=encryptAmazon SES:
POSTFIX_RELAYHOST=[email-smtp.us-east-1.amazonaws.com]:587POSTFIX_RELAYHOST_AUTH_ENABLE=truePOSTFIX_RELAYHOST_USERNAME=your-ses-smtp-usernamePOSTFIX_RELAYHOST_PASSWORD=your-ses-smtp-passwordPOSTFIX_SMTP_TLS=encryptTroubleshooting
| Symptom | Solution |
|---|---|
Connection refused to database | Verify DB_HOST and DB_PORT match your MySQL deployment. For Klutch.sh TCP apps, use port 8000. |
| Emails not forwarding | Check MX records point to your server. Verify Postfix is running in container logs. |
| DKIM validation fails | Ensure DKIM keys are generated and DNS TXT record matches /data/dkim/example.com.txt. |
| Outbound emails rejected | Configure an SMTP relay (SendGrid, Mailgun, SES) to bypass port 25 restrictions. |
APP_KEY missing | Generate with echo "base64:$(openssl rand -base64 32)" and add to environment variables. |
| Registration disabled | Set ANONADDY_ENABLE_REGISTRATION=true or create users via anonaddy:create-user command. |
| Data lost after redeploy | Ensure /data is mounted to a persistent volume. |
Security best practices
- Generate strong secrets: Use long, random strings for
APP_KEYandANONADDY_SECRET. - Use Klutch.sh secrets: Mark database passwords, API keys, and secrets as encrypted in the environment variables UI.
- Disable registration: Set
ANONADDY_ENABLE_REGISTRATION=falseafter creating your account if running a private instance. - Enable DKIM signing: Configure Rspamd and DKIM to improve email deliverability and prevent spoofing.
- Regular backups: Back up the
/datavolume regularly, especially DKIM keys. - Monitor logs: Check container logs for failed deliveries or authentication issues.
Next steps
- Review the Monitoring guide to set up log streaming and alerts.
- Configure a custom domain using the Custom Domains documentation.
- Explore AnonAddy’s browser extension for quick alias generation.
- Set up the official Android or iOS apps for mobile access.