I was using QmailAgent to manage my email accounts and treated it as email archiving tools. But I cannot export QmailAgent’s database with ease. I decided to use another tool name piler to manage my email archive.

Piler is not a tool with easy installation, the documentation on installation is very limited. I was using a lot of time in making it working on my Unraid.

Piler offers an open source version, that was an older version of the this tool. I am using the 1.4.4 version to be my email archiving tool. For older or newer version, the configuration can be very different.

In this tutorial, I stick to the barebone of the system - no reverse proxy, no built-in database. Just a working piler by deploying its docker image. I deploy this utility in my Unraid NAS.

Installing the docker #

  1. You will need a MySQL database running in your system. Create a database named piler with username and password as piler and piler123 respectively. You can use Adminer to perform this job.

  2. Here comes the docker compose file, use it in creating the docker:

version: '3.3'
services:
    piler:
        container_name: piler
        network_mode: piler-network
        environment:
            - PILER_HOSTNAME=mail.example.com # your own domain
            - MYSQL_HOSTNAME=mariadb # I have another mariadb docker
            - MYSQL_USER=piler # user name configured above
            - MYSQL_PASSWORD=piler123 # password configured above
            - MYSQL_DATABASE=piler # name for the database
        ports:
            - '380:80/tcp'
            - '3443:443/tcp'
            - '325:25/tcp'
        volumes:
            - '/mnt/user/backup/emailbackup:/var/piler/store:rw' # location for email storage
            - '/mnt/user/appdata/piler/etc/:/etc/piler:rw' # location of piler configuration files
            - '/mnt/user/appdata/piler/manticore/:/var/piler/manticore:rw' # location for indexing tools
        image: 'sutoj/piler:1.4.4'
  1. Remember to forward the corresponding ports on your router.
  2. After the installation, you can check the log to see whether piler actually runs on your machine. Piler can create a very detailed log recording the email arriving your server, but the docker image does not include syslog by default. We will need to install it:
# in the docker console
# su
$ apt install syslog-ng

# after installation, enable the syslog-ng
$ service syslog-ng start

# you can check the mail incoming log here, other logs are also stored there:
$ cat /var/log/mail.log
  1. We will need to configure two more documents to ensure piler functions properly. They are all located at /etc/piler. First, check config-site.php, make sure SITENAMECONST is correct. Other items like the database name and password is correct.

  2. The second document is very important, configure piler.conf:

# this one is important, for you will be forwarding all your emails to this account. And piler will be handling it for you
archive_address=archive@mail.example.com 

# configure the default retention day, please note that the retention days should not be too long, I tried 30000 before, and it was more than the database integer maximum.
default_retention_days=18250

# whether enable support for CJKV fonts
enable_cjk=1 
  1. You are almost done. You will need to create domains, users by using admin accounts. Some default accounts of piler are:
Account            Password
admin@local        pilerrocks
auditor@local      auditor

Note

Please note that admin account does not normally have the access to the emails, while auditor account will be having the access to all the emails.