Skip to content

Deploying SquirrelMail

Introduction

SquirrelMail is a classic, standards-based webmail application that provides email access through any web browser. Known for its stability, low resource requirements, and compatibility with almost any IMAP server, SquirrelMail has been a reliable choice for webmail since 1999.

Built entirely in PHP with no JavaScript required, SquirrelMail works in virtually any browser, including text-based browsers and older systems. Its plugin architecture allows extensive customization while maintaining the core simplicity that makes it so reliable.

Key highlights of SquirrelMail:

  • Universal Compatibility: Works in any browser, including text-based ones
  • IMAP/SMTP Support: Connect to any standard email server
  • Lightweight: Minimal server and client resource requirements
  • Plugin System: Extensive plugin ecosystem for added features
  • No JavaScript Required: Pure HTML interface for maximum compatibility
  • Address Book: Built-in contact management
  • Folder Management: Full IMAP folder support
  • Search: Search messages across folders
  • Attachment Handling: Upload and download attachments
  • Multi-Language: Available in many languages
  • Themes: Customizable appearance with themes
  • Open Source: GPLv2 licensed

This guide walks through deploying SquirrelMail on Klutch.sh using Docker for a reliable, lightweight webmail solution.

Why Deploy SquirrelMail on Klutch.sh

Deploying SquirrelMail on Klutch.sh provides several advantages:

Simplified Deployment: Klutch.sh handles the container deployment automatically.

HTTPS by Default: Secure webmail access with automatic SSL certificates.

Persistent Storage: User preferences and address books persist across deployments.

GitHub Integration: Version control your configuration and deploy updates automatically.

Low Resource Usage: SquirrelMail runs efficiently with minimal resources.

Custom Domains: Use your own domain for professional webmail access.

Always Available: Access your email 24/7 from any device.

Universal Access: Works on any device with a web browser.

Prerequisites

Before deploying SquirrelMail on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • An IMAP/SMTP email server to connect to
  • Basic familiarity with Docker
  • (Optional) A custom domain for your webmail

Deploying SquirrelMail on Klutch.sh

    Create a GitHub Repository

    Create a new GitHub repository for your SquirrelMail deployment.

    Create Your Dockerfile

    Create a Dockerfile in your repository:

    FROM php:7.4-apache
    # Install required PHP extensions and dependencies
    RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    unzip \
    wget \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install gd \
    && docker-php-ext-install gettext \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
    # Download and install SquirrelMail
    WORKDIR /var/www/html
    RUN wget https://sourceforge.net/projects/squirrelmail/files/stable/1.4.22/squirrelmail-webmail-1.4.22.tar.gz \
    && tar -xzf squirrelmail-webmail-1.4.22.tar.gz \
    && mv squirrelmail-webmail-1.4.22 squirrelmail \
    && rm squirrelmail-webmail-1.4.22.tar.gz
    # Create data directories
    RUN mkdir -p /var/local/squirrelmail/data \
    && mkdir -p /var/local/squirrelmail/attach \
    && chown -R www-data:www-data /var/local/squirrelmail \
    && chown -R www-data:www-data /var/www/html/squirrelmail
    # Copy configuration
    COPY config.php /var/www/html/squirrelmail/config/config.php
    EXPOSE 80
    HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
    CMD curl -f http://localhost/squirrelmail/ || exit 1

    Create Configuration File

    Create config.php with your mail server settings:

    <?php
    $config_version = '1.4.0';
    $config_use_color = 1;
    // Organization settings
    $org_name = "Your Organization";
    $org_logo = SM_PATH . 'images/sm_logo.png';
    $org_logo_width = '308';
    $org_logo_height = '111';
    $org_title = "SquirrelMail";
    $signout_page = '';
    $frame_top = '_top';
    // Server settings
    $domain = 'your-domain.com';
    $imapServerAddress = 'imap.your-domain.com';
    $imapPort = 993;
    $useSendmail = false;
    $smtpServerAddress = 'smtp.your-domain.com';
    $smtpPort = 587;
    $sendmail_path = '/usr/sbin/sendmail';
    $sendmail_args = '-i -t';
    $pop_before_smtp = false;
    $imap_server_type = 'other';
    $invert_time = false;
    $optional_delimiter = 'detect';
    $encode_header_key = '';
    // Data directories
    $data_dir = '/var/local/squirrelmail/data/';
    $attachment_dir = '/var/local/squirrelmail/attach/';
    // Security
    $check_referrer = '';
    $security_tokens = true;
    $use_smtp_tls = true;
    $use_imap_tls = true;
    $smtp_auth_mech = 'login';
    $imap_auth_mech = 'login';
    // Default settings
    $default_folder_prefix = '';
    $trash_folder = 'Trash';
    $sent_folder = 'Sent';
    $draft_folder = 'Drafts';
    $default_move_to_trash = true;
    $default_move_to_sent = true;
    $default_save_as_draft = true;
    $show_prefix_option = false;
    $list_special_folders_first = true;
    $use_special_folder_color = true;
    $auto_expunge = true;
    $default_sub_of_inbox = true;
    $show_contain_subfolders_option = false;
    $default_unseen_notify = 2;
    $default_unseen_type = 1;
    $auto_create_special = true;
    $delete_folder = false;
    $nostrstrp_before_langstrp = false;
    // Theme
    $theme_css = '';
    $theme_default = 0;
    $theme[0]['PATH'] = SM_PATH . 'themes/default_theme.php';
    $theme[0]['NAME'] = 'Default';
    // Plugins
    $plugins = array();
    // Localization
    $squirrelmail_default_language = 'en_US';
    $default_charset = 'iso-8859-1';
    $losstrpt_default_charset = 'iso-8859-15';
    // Other
    $allow_advanced_search = 0;
    $allow_thread_sort = false;
    $allow_server_sort = false;
    $allow_charset_search = true;
    $uid_support = true;
    $session_name = 'SQMSESSID';
    $skip_SM_header = false;
    $edit_identity = true;
    $edit_name = true;
    $edit_reply_to = true;
    $hide_auth_header = false;
    $disable_thread_sort = false;
    $disable_server_sort = false;
    $only_fetch_langstr = false;
    $color_strpphp_morestrpquote_levels = 4;
    $mailto_formatting = 'none';
    $addrbook_dsn = '';
    $addrbook_table = 'address';
    $prefs_dsn = '';
    $prefs_table = 'userprefs';
    $prefs_user_field = 'user';
    $prefs_key_field = 'prefkey';
    $prefs_val_field = 'prefval';
    $no_list_for_strppsubscribe = false;
    $smtp_siterule_type = 'domain';
    $sm_debug_mode = SM_DEBUG_MODE_OFF;
    @include SM_PATH . 'config/config_local.php';
    ?>

    Push Your Repository to GitHub

    Commit and push your Dockerfile and configuration.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project.

    Create a New App

    Within your project, create a new app and connect your GitHub repository.

    Configure HTTP Traffic

    In the deployment settings:

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

    Attach Persistent Volumes

    Add the following volumes:

    Mount PathRecommended SizePurpose
    /var/local/squirrelmail/data5 GBUser preferences and address books
    /var/local/squirrelmail/attach10 GBTemporary attachment storage

    Deploy Your Application

    Click Deploy to build and start SquirrelMail.

    Access SquirrelMail

    Once deployment completes, access SquirrelMail at https://your-app-name.klutch.sh/squirrelmail/.

Using SquirrelMail

Logging In

Navigate to your SquirrelMail URL and enter:

  • Username: Your email username (often the full email address)
  • Password: Your email password

Reading Email

  1. Messages appear in the message list
  2. Click a message to read it
  3. Use folder navigation on the left

Composing Email

  1. Click Compose
  2. Enter recipients, subject, and message
  3. Attach files if needed
  4. Click Send

Managing Folders

  1. Navigate to Folders
  2. Create, rename, or delete folders
  3. Subscribe to IMAP folders

Address Book

  1. Go to Addresses
  2. Add, edit, or delete contacts
  3. Import/export address books

Configuration

Mail Server Settings

Update config.php with your server details:

SettingDescription
$imapServerAddressIMAP server hostname
$imapPortIMAP port (993 for SSL, 143 for plain)
$smtpServerAddressSMTP server hostname
$smtpPortSMTP port (587 for TLS, 465 for SSL)
$use_imap_tlsEnable IMAP TLS
$use_smtp_tlsEnable SMTP TLS

Plugins

Enable plugins by adding to the $plugins array in config.php:

$plugins[] = 'delete_move_next';
$plugins[] = 'listcommands';
$plugins[] = 'newmail';
$plugins[] = 'sent_subfolders';
$plugins[] = 'squirrelspell';

Themes

Additional themes can be configured in the theme array:

$theme[1]['PATH'] = SM_PATH . 'themes/forest.php';
$theme[1]['NAME'] = 'Forest';

Troubleshooting

Cannot Connect to IMAP

  • Verify IMAP server address and port
  • Check TLS/SSL settings match your server
  • Ensure firewall allows outbound connections

Login Failed

  • Verify credentials are correct
  • Check authentication method matches server
  • Review server logs for specific errors

Email Not Sending

  • Verify SMTP settings
  • Check SMTP authentication credentials
  • Ensure TLS settings are correct

Attachments Failing

  • Check attachment directory permissions
  • Verify PHP upload limits
  • Ensure sufficient storage space

Additional Resources

Conclusion

Deploying SquirrelMail on Klutch.sh gives you a reliable, lightweight webmail solution that works in any browser. With its proven stability, low resource requirements, and universal compatibility, SquirrelMail provides dependable email access without the complexity of modern webmail applications. Perfect for organizations that need simple, reliable webmail or users who prefer a no-frills email interface.