Configuring the mail server for email archiving with piler enterprise edition#

Revision #1

Publication date: Apr 20, 2023

Configure the mail server#

To start archiving emails you have to configure your mail servers to copy each and every single email they receive to piler via SMTP.

The configuration process depends on the used mail server. We’ll use address as an example where to send the emails. Be sure to use your own archive’s domain name!

For multi-tenant installations the local part must match the customer (=tenant) ID, eg. if the customer id is “customer1”, then the address to forward emails is


Add the following to then issue the postfix reload command:

always_bcc =


Open the Axigen web admin interface. Go to “SECURITY & FILTERING”, then click on “Acceptance & Routing”, finally click on “ADVANCED SETTINGS”.

Click on “ADD ACCEPTANCE / ROUTING RULE”, and fill the rule name, the conditions and the actions fields, see the example below. Then click on the “SAVE CONFIGURATION” button.

Office 365#

Configure networking, and make sure that Office 365 can reach on port 25. This may require setting some firewall rules, etc.

Create a mailbox for NDR reports#

Login at office 365 admin portal, then go to “Users” → “Active users” menu, and create a user for receiving undeliverable journal reports, eg.

Create a journaling rule#

Go to Exchange admin center, then “compliance management”, and select “journal rules”. Click right next to “Send undeliverable journal reports to:”, and specify the address you just created (ie.

Microsoft Exchange in general#

Basically you have to create SMTP journaling in Exchange, find the details on the different Exchange versions below.

Note that you may have to force the GUI to rewrite the Message-id header field preventing Exchange to discard the restored message as a duplicate. Edit config-site.php, and set the following:

$config['REWRITE_MESSAGE_ID'] = 1;

Exchange 2003#

Exchange 2007#

Create SMTP contact#

Configure Message Format Settings#

With this setting, journal reports are sent in MIME rather than S/TNEF.

Enable Standard Journaling#

Exchange 2010#

Create SMTP Contact#

Enable Standard Journaling#

Create a Send Connector#

Exchange 2013#

Setup Journaling#

Create a Send Connector#

Adjust Maximum Message Size#

By default, the maximum send message size for the Connector is set to 10 MB. To change this:

Disable Non Delivery Reports (optional)#

Kerio Connect#

See the detailed instructions at for notenant piler installations (“Archiving the whole server”) as well as multi-tenant piler installations (“Archiving individual domains”).


Zimbra uses postfix internally, so you may use the postfix approach: find the zimbra version of, and apply the same as for postfix.


For no-tenant deployments, create a system wide filter, eg. /etc/exim.filter with the following content:

unseen deliver

Then specify the filter in your exim config file (on Ubuntu create /etc/exim4/conf.d/main/30_exim4-config_system_filter), and restart exim:

system_filter = /etc/exim.filter

Also check out

Notes for mail service providers#

This chapter applies to mail service providers, how to configure postfix to send copies of emails to the archive properly.

The problem#

if you set always_bcc = some@address, then postfix sends a copy of messages to some@address. Let’s say you host mailboxes for both and Now if customer1 sends an email to customer2, then postfix will send a single copy only to customer2@, so the email is archived for customer2 only, but customer1 won’t see this email in their archive.

The solution#

Configure postfix in the following way. The below config also enables you to selectively archive emails for specific domains or mailboxes only.


recipient_bcc_maps = pcre:/etc/postfix/bcc_map
sender_bcc_maps = pcre:/etc/postfix/bcc_map
smtp_destination_recipient_limit = 1



Alternate solution if postfix and piler smtp are on the same host:

Let postfix listen on the public interface, and piler-smtp on the localhost, and apply the following setup:

myhostname =
virtual_mailbox_domains =
virtual_alias_maps = pcre:/etc/postfix/bcc_map
smtp_destination_recipient_limit = 1
content_filter = smtp:[]:25