A Docker container for SnappyMail - a simple, modern & fast web-based email client.
SnappyMail is a drastically upgraded & secured fork of RainLoop Webmail Community edition, providing a lightweight, fast, and secure webmail interface.
- PHP 8.2 with Apache web server
- All required PHP extensions for SnappyMail functionality
- Optimized configuration for performance and security
- Volume support for persistent data storage
- Health checks included
- Simple Docker setup
Prebuilt Docker images are available at Docker Hub.
# Run with prebuilt image
docker run -d \
--name snappymail \
-p 8080:80 \
-v snappymail_data:/var/www/html/data \
-e SNAPPYMAIL_ADMIN_USER=myadmin \
-e SNAPPYMAIL_ADMIN_PASS=mypassword \
-e TZ=America/New_York \
--restart unless-stopped \
itefixnet/snappymail:latest- Clone this repository:
git clone <repository-url>
cd snappymail-docker- Build and run the container:
# Build the image (uses default version 2.38.2)
docker build -t snappymail .
# Or build with a specific SnappyMail version
docker build --build-arg SNAPPYMAIL_VERSION=2.38.1 -t snappymail .
# Run the container (admin credentials and timezone are REQUIRED)
docker run -d \
--name snappymail \
-p 8080:80 \
-v snappymail_data:/var/www/html/data \
-e SNAPPYMAIL_ADMIN_USER=myadmin \
-e SNAPPYMAIL_ADMIN_PASS=mypassword \
-e TZ=Europe/Oslo \
--restart unless-stopped \
snappymail- Access SnappyMail at
http://localhost:8080
-
Access the Admin Interface: Navigate to
http://localhost:8080/?admin -
First Login:
- Use the admin credentials you set via the
SNAPPYMAIL_ADMIN_USERandSNAPPYMAIL_ADMIN_PASSenvironment variables
- Use the admin credentials you set via the
-
Configure Mail Server: Set up your IMAP/SMTP server settings in the admin panel
-
Security: Change the default admin password immediately after first login
SNAPPYMAIL_ADMIN_USER: Admin username (REQUIRED)SNAPPYMAIL_ADMIN_PASS: Admin password (REQUIRED)TZ: Timezone (REQUIRED) - See TIMEZONES.md or Wikipedia
SNAPPYMAIL_MAX_ATTACHMENT_SIZE: Maximum attachment size (default: 50M)
/var/www/html/data: SnappyMail data directory (configurations, logs, cache)
80: HTTP port (mapped to8080in the run command)
Configure your email server settings in the admin panel at http://localhost:8080/?admin:
- IMAP: Port
993with SSL/TLS encryption - SMTP: Port
587with STARTTLS encryption
Most modern email providers use these standard ports and encryption methods.
- Use HTTPS: Always use HTTPS in production (consider a reverse proxy like Traefik or nginx)
- Secure Data Directory: The
datadirectory contains sensitive information - Regular Updates: Keep the container updated with the latest SnappyMail version
- Firewall: Restrict access to the admin panel (
/?admin)
SNAPPYMAIL_VERSION: SnappyMail version to download (default: 2.38.2)
# Build with default version
docker build -t snappymail .
# Build with specific version
docker build --build-arg SNAPPYMAIL_VERSION=2.38.1 -t snappymail .
# Build with latest version (check GitHub releases)
docker build --build-arg SNAPPYMAIL_VERSION=2.39.0 -t snappymail .Note: Check SnappyMail releases for available versions.
All required variables must be provided:
# Basic setup with required variables
docker run -d \
--name snappymail \
-p 8080:80 \
-v snappymail_data:/var/www/html/data \
-e SNAPPYMAIL_ADMIN_USER=myusername \
-e SNAPPYMAIL_ADMIN_PASS=mypassword \
-e TZ=Europe/London \
--restart unless-stopped \
snappymail
# With custom attachment size
docker run -d \
--name snappymail \
-p 8080:80 \
-v snappymail_data:/var/www/html/data \
-e SNAPPYMAIL_ADMIN_USER=myusername \
-e SNAPPYMAIL_ADMIN_PASS=mypassword \
-e TZ=Asia/Tokyo \
-e SNAPPYMAIL_MAX_ATTACHMENT_SIZE=100M \
--restart unless-stopped \
snappymailFor a complete list of timezone identifiers, see:
- TIMEZONES.md - Common timezones included in this repository
- Wikipedia List - Complete timezone database
- IANA Time Zone Database - Official timezone database
Common examples: America/New_York, Europe/London, Asia/Tokyo, UTC
Note: The container will not start without SNAPPYMAIL_ADMIN_USER, SNAPPYMAIL_ADMIN_PASS, and TZ environment variables.
To modify PHP settings, mount a custom configuration file:
docker run -d \
--name snappymail \
-p 8080:80 \
-v snappymail_data:/var/www/html/data \
-v $(pwd)/custom-php.ini:/usr/local/etc/php/conf.d/custom.ini \
--restart unless-stopped \
snappymailTo backup your SnappyMail data:
docker run --rm \
-v snappymail_data:/data \
-v $(pwd)/backup:/backup \
alpine tar czf /backup/snappymail-backup-$(date +%Y%m%d).tar.gz -C /data .- PHP Extensions: mbstring (included in this Docker image)
- Memory: 128MB RAM recommended
- Storage: ~40MB for application, additional space for email data
# Container logs
docker logs snappymail
# Follow logs in real-time
docker logs -f snappymail
# Apache logs
docker exec snappymail tail -f /var/log/apache2/error.log# Fix permissions if needed
docker exec snappymail chown -R www-data:www-data /var/www/htmlIf you lose the admin password:
# Remove the admin password file to generate a new one
docker exec snappymail rm -f /var/www/html/data/_data_/_default_/admin_password.txt
# Restart container
docker restart snappymail
# Check new password
docker exec snappymail cat /var/www/html/data/_data_/_default_/admin_password.txtTo update to a newer version of SnappyMail:
- Update the
SNAPPYMAIL_VERSIONin the Dockerfile - Rebuild and restart the container:
# Stop current container docker stop snappymail docker rm snappymail # Rebuild and start docker build -t snappymail . docker run -d \ --name snappymail \ -p 8080:80 \ -v snappymail_data:/var/www/html/data \ --restart unless-stopped \ snappymail
Prebuilt images are available at: hub.docker.com/r/itefixnet/snappymail
For Docker Hub documentation, see: DOCKER_HUB_OVERVIEW.md
Feel free to contribute improvements, bug fixes, or feature requests.
This Docker configuration is provided as-is. SnappyMail itself is licensed under GNU AGPL v3.