Deploying b1gMail
Introduction
b1gMail is an open-source webmail and email hosting solution that provides a complete email platform for individuals and organizations. It combines a powerful mail server with a user-friendly webmail interface, making it a comprehensive solution for self-hosted email.
Originally developed in the early 2000s and continuously maintained, b1gMail has evolved into a mature platform with features rivaling commercial email services. It supports multiple domains, user management, and extensive customization options.
Key highlights of b1gMail:
- Complete Email Solution: Integrated MTA, POP3, IMAP, and webmail
- Multi-Domain Support: Host email for multiple domains
- User Management: Admin panel for managing users and quotas
- Webmail Interface: Full-featured browser-based email client
- Address Book: Contact management with import/export
- Calendar: Integrated calendar functionality
- File Storage: Webdisk for file storage and sharing
- SMS Gateway: Optional SMS notification support
- Spam Protection: Integrated spam filtering
- Plugin System: Extend functionality with plugins
- Themes: Customizable appearance
- Multi-Language: Support for multiple languages
This guide walks through deploying b1gMail on Klutch.sh using Docker for a self-hosted email solution.
Why Deploy b1gMail on Klutch.sh
Deploying b1gMail on Klutch.sh provides several advantages for email hosting:
Email Independence: Control your own email infrastructure without relying on third parties.
HTTPS by Default: Secure webmail access with automatic SSL certificates.
Persistent Storage: Reliable storage for mailboxes and attachments.
Custom Domains: Use your own domain for professional email addresses.
Always Available: Email service remains accessible 24/7.
Scalable Resources: Allocate resources based on mailbox count and traffic.
Prerequisites
Before deploying b1gMail on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your configuration
- A domain name with DNS management access
- Basic understanding of Docker and containerization
- Knowledge of email infrastructure (MX records, SPF, DKIM)
Understanding b1gMail Architecture
b1gMail integrates several components:
Web Application: PHP-based frontend for webmail and administration.
Mail Server: Handles SMTP, POP3, and IMAP protocols.
MySQL Database: Stores user data, emails, and configuration.
File Storage: Stores attachments and webdisk files.
Preparing Your Repository
Create a GitHub repository for your b1gMail deployment.
Repository Structure
b1gmail-deploy/├── Dockerfile├── config/│ └── b1gmail.conf└── .dockerignoreCreating the Dockerfile
Create a Dockerfile for b1gMail:
FROM php:8.1-apache
# Install dependenciesRUN apt-get update && apt-get install -y \ libpng-dev \ libjpeg-dev \ libfreetype6-dev \ libzip-dev \ libxml2-dev \ unzip \ wget \ postfix \ dovecot-imapd \ dovecot-pop3d \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install gd mysqli pdo pdo_mysql zip xml \ && rm -rf /var/lib/apt/lists/*
# Enable Apache modulesRUN a2enmod rewrite
# Download and install b1gMailWORKDIR /var/www/htmlRUN wget -q https://github.com/b1gMail/b1gMail/archive/refs/heads/master.zip \ && unzip master.zip \ && mv b1gMail-master/* . \ && rm -rf master.zip b1gMail-master
# Set permissionsRUN chown -R www-data:www-data /var/www/html \ && chmod -R 755 /var/www/html
# Environment variablesENV B1GMAIL_DB_HOST=${B1GMAIL_DB_HOST}ENV B1GMAIL_DB_NAME=${B1GMAIL_DB_NAME:-b1gmail}ENV B1GMAIL_DB_USER=${B1GMAIL_DB_USER:-b1gmail}ENV B1GMAIL_DB_PASSWORD=${B1GMAIL_DB_PASSWORD}
# Expose portsEXPOSE 80 25 110 143 993 995
# Volume for mail storageVOLUME ["/var/mail"]
# Start servicesCMD ["apache2-foreground"]Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
B1GMAIL_DB_HOST | Yes | - | MySQL database hostname |
B1GMAIL_DB_NAME | No | b1gmail | Database name |
B1GMAIL_DB_USER | No | b1gmail | Database username |
B1GMAIL_DB_PASSWORD | Yes | - | Database password |
MAIL_DOMAIN | Yes | - | Primary mail domain |
Deploying b1gMail on Klutch.sh
- A Record: mail.yourdomain.com
- MX Record: Priority 10, mail.yourdomain.com
- SPF Record: TXT record for email authentication
- DKIM Record: TXT record for signing
- Select HTTP as the traffic type
- Set the internal port to 80
Configure DNS Records
Set up DNS for your mail domain:
Generate Database Password
Create a secure database password:
openssl rand -base64 24Push Your Repository to GitHub
Initialize and push your configuration to GitHub.
Create a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project named “b1gmail” or “mail”.
Create a New App
Within your project, create a new app and connect your GitHub repository.
Configure HTTP Traffic
Set up HTTP for the webmail interface:
Set Environment Variables
Configure the following:
| Variable | Value |
|---|---|
B1GMAIL_DB_HOST | Database hostname |
B1GMAIL_DB_NAME | b1gmail |
B1GMAIL_DB_USER | b1gmail |
B1GMAIL_DB_PASSWORD | Your generated password |
MAIL_DOMAIN | yourdomain.com |
Attach Persistent Volumes
Add storage for mail and data:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/mail | 100+ GB | User mailboxes |
/var/www/html/data | 10 GB | Application data |
Deploy Your Application
Click Deploy to build and start b1gMail.
Complete Installation
Access your instance and complete the web-based installation wizard.
Initial Configuration
Installation Wizard
- Navigate to your b1gMail URL
- Follow the installation wizard:
- Check system requirements
- Configure database connection
- Set admin credentials
- Configure mail domain
- Complete installation
Admin Panel
Access the admin panel:
- Log in with admin credentials
- Navigate to Admin > Prefs for system settings
- Configure mail server settings
- Set up user quotas and policies
User Management
Creating Users
Add new email users:
- Navigate to Admin > Users
- Click “Add User”
- Fill in user details and email address
- Set mailbox quota
- Save user
User Features
Configure user capabilities:
- Email sending and receiving
- Webdisk storage
- Calendar access
- Address book
Email Configuration
Client Settings
For email clients:
IMAP:
- Server: mail.yourdomain.com
- Port: 993 (SSL) or 143 (STARTTLS)
- Username: Full email address
POP3:
- Server: mail.yourdomain.com
- Port: 995 (SSL) or 110 (STARTTLS)
SMTP:
- Server: mail.yourdomain.com
- Port: 587 (STARTTLS) or 465 (SSL)
- Authentication: Required
Spam Protection
Configure spam filtering:
- Navigate to Admin > AntiSpam
- Enable spam filtering
- Configure sensitivity
- Set spam folder behavior
Troubleshooting Common Issues
Email Not Sending
Solutions:
- Verify MX and SPF records
- Check SMTP port accessibility
- Review mail logs for errors
Cannot Receive Email
Solutions:
- Confirm MX records point to your server
- Verify mail server is running
- Check mailbox quotas
Webmail Login Issues
Solutions:
- Verify database connection
- Check user credentials
- Review PHP error logs
Additional Resources
Conclusion
Deploying b1gMail on Klutch.sh gives you a complete, self-hosted email solution with webmail, POP3, IMAP, and SMTP capabilities. With user management, spam protection, and a full-featured webmail interface, b1gMail provides everything needed for independent email hosting.