Skip to content

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
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile for b1gMail:

FROM php:8.1-apache
# Install dependencies
RUN 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 modules
RUN a2enmod rewrite
# Download and install b1gMail
WORKDIR /var/www/html
RUN 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 permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# Environment variables
ENV 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 ports
EXPOSE 80 25 110 143 993 995
# Volume for mail storage
VOLUME ["/var/mail"]
# Start services
CMD ["apache2-foreground"]

Environment Variables Reference

VariableRequiredDefaultDescription
B1GMAIL_DB_HOSTYes-MySQL database hostname
B1GMAIL_DB_NAMENob1gmailDatabase name
B1GMAIL_DB_USERNob1gmailDatabase username
B1GMAIL_DB_PASSWORDYes-Database password
MAIL_DOMAINYes-Primary mail domain

Deploying b1gMail on Klutch.sh

    Configure DNS Records

    Set up DNS for your mail domain:

    • 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

    Generate Database Password

    Create a secure database password:

    Terminal window
    openssl rand -base64 24

    Push 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:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Set Environment Variables

    Configure the following:

    VariableValue
    B1GMAIL_DB_HOSTDatabase hostname
    B1GMAIL_DB_NAMEb1gmail
    B1GMAIL_DB_USERb1gmail
    B1GMAIL_DB_PASSWORDYour generated password
    MAIL_DOMAINyourdomain.com

    Attach Persistent Volumes

    Add storage for mail and data:

    Mount PathRecommended SizePurpose
    /var/mail100+ GBUser mailboxes
    /var/www/html/data10 GBApplication 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

  1. Navigate to your b1gMail URL
  2. Follow the installation wizard:
    • Check system requirements
    • Configure database connection
    • Set admin credentials
    • Configure mail domain
  3. Complete installation

Admin Panel

Access the admin panel:

  1. Log in with admin credentials
  2. Navigate to Admin > Prefs for system settings
  3. Configure mail server settings
  4. Set up user quotas and policies

User Management

Creating Users

Add new email users:

  1. Navigate to Admin > Users
  2. Click “Add User”
  3. Fill in user details and email address
  4. Set mailbox quota
  5. 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:

  1. Navigate to Admin > AntiSpam
  2. Enable spam filtering
  3. Configure sensitivity
  4. 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.