Business Email

Bichon on a VPS: archive and search your IMAP email

A mailbox is not an archive. It fills up to its quota, gets emptied to make room, disappears when an employee leaves or when you switch providers — and with it go years of exchanges with your customers. Bichon is an open-source email archiving server (AGPL-3.0 licensed), written in Rust: it connects to your IMAP mailboxes, copies every message into an archive that belongs to you and indexes it in full text. This guide installs it on a VPS with Docker Compose, publishes it over HTTPS behind nginx, then connects a first mailbox.

Deploy on a VPS Cloud →
6 min read3 steps
Contents· Why archive your email outside the mailbox1/11
  1. 01Why archive your email outside the mailbox
  2. 02What Bichon brings
  3. 03Three ways to keep old email
  4. 04Prerequisites
  5. 05Install Bichon with Docker Compose
  6. 06Change the factory password before opening the address
  7. 07Publish Bichon over HTTPS behind nginx
  8. 08Archive a first IMAP mailbox
  9. 09Import your old PST, MBOX or EML exports
  10. 10Backup and security
  11. 11Bichon in one click on ServOrbit

Why archive your email outside the mailbox

A mail server is built to send and receive, not to keep. Shared hosting caps mailbox size, users delete to make room, and a closed account takes all its content with it. The day you need a quote accepted three years ago, or a supplier's reply in a dispute, the original mailbox is often gone.

Archiving means copying every message as it arrives to storage independent of the mailbox, then making it searchable. Bichon does exactly that: it reads your mailboxes over IMAP, keeps a copy of every message even when the original is deleted, and indexes senders, subjects, bodies and attachment names.

What Bichon brings

  • Continuous IMAP archiving — multiple accounts, password or OAuth2 login (Gmail, Microsoft 365), incremental sync and per-account schedules.
  • Full-text search — sender, recipients, subject, body and attachment names, with filters by account, folder and period.
  • Import what you already have — EML files, MBOX (including the Gmail export), Thunderbird profiles and Outlook PST files.
  • Export and restore — MBOX export, restoring messages to the original IMAP server.
  • Users and roles — multiple users, roles per archived account, TOTP two-factor authentication and API tokens.
  • Self-contained — one Rust binary with its built-in index: no database or Elasticsearch to install alongside.

Three ways to keep old email

Scroll the table

BichonLeave it in the mailboxPST or MBOX exports
Survives mailbox deletionYesNoYes, up to the last export
UpdatesContinuous, automatic—Manual, one-off
SearchFull text, across all mailboxesMailbox by mailboxFile by file, in a mail client
Provider quotaFreedReached sooner or laterFreed
Access for several peopleUsers and rolesShared credentialsCopying files

Prerequisites

An Ubuntu 24.04 VPS with 1 GB of RAM is enough to start; it is the disk you need to size: count the current size of the mailboxes to archive, plus the index and a year of growth. You need Docker with the Compose plugin, nginx with an HTTPS certificate, and a name — for example mail-archive.example.com — since the interface and administrator login will go over the Internet.

Install Bichon with Docker Compose

  1. Prepare the directory and the encryption key

    BICHON_ENCRYPT_PASSWORD encrypts the IMAP passwords and OAuth2 tokens Bichon stores. Generate it once and keep it: without it, accounts already configured can no longer reconnect.

    mkdir -p /opt/bichon && cd /opt/bichon
    echo "ENCRYPT_PASSWORD=$(openssl rand -hex 24)" > .env
    chmod 600 .env
  2. Write the docker-compose.yml

    The port is only published on the loopback interface: only nginx can reach it. BICHON_TRUSTED_PROXIES accepts the X-Forwarded-For header from the Docker network, so that logs and login rate limiting see the visitors' real address.

    services:
      bichon:
        image: rustmailer/bichon:2.4.6
        restart: unless-stopped
        ports:
          - "127.0.0.1:15630:15630"
        environment:
          BICHON_ROOT_DIR: /data
          BICHON_ENCRYPT_PASSWORD: ${ENCRYPT_PASSWORD}
          BICHON_PUBLIC_URL: https://mail-archive.example.com
          BICHON_TRUSTED_PROXIES: 172.16.0.0/12
        volumes:
          - bichon-data:/data
    
    volumes:
      bichon-data: {}
  3. Start and check

    The image ships its own health check: wait for the healthy state, then query the status route, which returns the version and uptime.

    docker compose up -d
    docker compose ps
    curl -s http://127.0.0.1:15630/api/status

Change the factory password before opening the address

On first start, Bichon creates the admin user with the password admin@bichon. That password opens no session: it forces you to choose a new one. But whoever uses it first chooses the administrator password — if the address is public before you have done it, someone else can do it for you. Log in and change it before publishing the vhost, for example through an SSH tunnel (ssh -L 15630:127.0.0.1:15630 root@your-vps), then enable two-factor authentication.

Publish Bichon over HTTPS behind nginx

Bichon does not handle TLS itself: nginx does and forwards requests to it. The maximum upload size is raised for PST or MBOX imports through the interface, and the read timeout extended for long operations.

server {
    listen 443 ssl;
    server_name mail-archive.example.com;
    # ssl_certificate + ssl_certificate_key (Let's Encrypt)
    client_max_body_size 2g;

    location / {
        proxy_pass http://127.0.0.1:15630;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 600s;
    }
}

Reload nginx (nginx -t && systemctl reload nginx), then open https://mail-archive.example.com. BICHON_PUBLIC_URL must carry the same address: it is the one Bichon gives Google and Microsoft as the redirect address for OAuth2 sign-ins.

Archive a first IMAP mailbox

In Accounts, add a mailbox: IMAP server, port 993 with TLS, username and password. For an address hosted on cPanel, these are the full email address and its password, with the server mail.your-domain.com. Gmail and Microsoft 365 preferably connect through OAuth2, after registering the application with Google or Microsoft.

Then choose the folders to archive — at least the inbox and sent items — and the sync frequency. The first pass copies the whole history, which can take hours on a mailbox of several gigabytes; the next ones only fetch new messages. Search works as soon as the first messages have arrived.

Import your old PST, MBOX or EML exports

Mailboxes that no longer exist often left an export behind: an Outlook PST file, an MBOX from Google Takeout, a Thunderbird profile folder or EML files. Bichon imports them from the interface and stores them in the same archive as the synced mailboxes: a single search then covers old and new. For very large files, the bichon-cli command-line tool avoids going through the browser.

The other way round, Bichon exports to MBOX and can restore messages to the original IMAP server: useful after an accidental deletion, or to push history back into a new mailbox after a provider switch.

Backup and security

The whole archive lives in the /data volume: messages, search index and configuration. Back it up regularly, with the container stopped to get a consistent copy.

cd /opt/bichon
docker compose stop bichon
docker run --rm -v bichon_bichon-data:/data -v /root/backups:/backup ubuntu \
  tar czf /backup/bichon-$(date +%F).tar.gz -C /data .
docker compose start bichon

The BICHON_ENCRYPT_PASSWORD key only protects stored credentials, not messages: the archive itself is not encrypted by Bichon. Its protection therefore relies on access to the VPS, two-factor authentication on the application's accounts and backups that are themselves encrypted. Give each employee their own account, with a role limited to the mailboxes that concern them.

Bichon in one click on ServOrbit

On a ServOrbit VPS, the Marketplace does all of the above for you: official container, port on the loopback interface, encryption key generated, factory password replaced at install time with a random password shown in your client area, nginx reverse proxy over HTTPS. You choose the address — a subdomain of one of your domains, or the VPS's free subdomain — and all that is left is adding your mailboxes. For scanned documents and attachments to file, pair it with Paperless-ngx.

Share this articleservorbit.com/ma-en/blog/self-host-bichon-vps-email-archiving

Your email archived, on your own VPS

Prices shown excluding VAT, with their renewal price.