Sometimes a user deletes a mail from their mailbox before it has been backed up over night, leaving no way to recover it. In order to be able to recover those mails, the use of shadow_transport in Exim can be used. This will essentially deliver a copy of an incoming mail to a separate backup Maildir directory. This directory can/should be purged of old files/mails in a cronjob to ensure it doesn't fill up. So how can we set this up?
The
In addition to this, we need to add the
The goal is the only backup mail that is delivered to an actual mailbox (hence the lookup against
So to sum up, my questions are:
1) Which transports would
2) Can we have a way of adding
The
begin transports
section in /etc/exim.conf
file contains a line that includes /etc/exim.transports.pre.conf
if it exists. This is where we can place our new transport, for example something like this:
Code:
shadow_copy_incoming_email:
driver = appendfile
create_directory
directory_mode = 0770
maildir_format
mode = 0660
# This will expand to: /var/local/mail-backup/YYYY-MM-DD/mydomain.com/myuser/Maildir/
directory = /var/local/mail-backup/${substr_0_10:$tod_log}/$domain_data/${lookup{$local_part}lsearch,ret=key{/etc/virtual/$domain_data/passwd}{$value}}/Maildir/
delivery_date_add
envelope_to_add
return_path_add
group = mail
user = mail
In addition to this, we need to add the
shadow_transport = shadow_copy_incoming_email
directive to the existing transport, where we want to have this additional backup delivery. This is where I am a little stuck.The goal is the only backup mail that is delivered to an actual mailbox (hence the lookup against
passwd
, and not aliases
for example). It looks like, on my test server, the only transport used for this is dovecot_lmtp_udp
, but I might be wrong. This particular transport also doesn't include any additional config files, which means I would need to modify /etc/exim.conf directly, which would then be overwritten.So to sum up, my questions are:
1) Which transports would
shadow_transport
need to be added to, to cover all local deliveries of virtual mail accounts?2) Can we have a way of adding
shadow_transport
to those transports, without having to modify /etc/exim.conf
directly?