2

I need to archive important mail incoming for specific address in case it gets accidentally deleted from email server, etc.

Either saving or using a pipe to archive it on backup machine is fine (I can rsync the backup automatically later, etc).

However, I have trouble to get system_filter working. I have configured it this way so far:

/etc/exim4/exim4.conf:

system_filter = /etc/exim4/system_filter
system_filter_user = Debian-exim
system_filter_group = Debian-exim

system_filter_directory_transport = local_copy_to_directory

# transport section

local_copy_to_directory:
    driver = appendfile
    delivery_date_add
    envelope_to_add
    return_path_add
    group = Debian-exim
    user = Debian-exim
    mode = 0660
    maildir_format = true
    create_directory = true

In /etc/exim4/system_filter:

# Exim filter
if $local_part is "example"
then
    unseen save /tmp/example_dir
endif

Nothing gets written in logs, nothing gets saved (normal delivery occurs of course).

When I change $local_part in system filter file to root and test it like so:

% exim  -bF /etc/exim4/system_filter -d-all+filter -f sender@example.com  <tfpmet 
Exim version 4.89 uid=0 gid=0 pid=1261 D=200
...
Return-path taken from "Return-path:" header line
Return-path = ex2@ex2.com
Sender      = sender@example.com
Recipient   = root@localdomain.com
Testing Exim filter file "/etc/exim4/system_filter"

Condition is true: $local_part is root
Unseen save message to: /tmp/example_dir
Filtering did not set up a significant delivery.
Normal delivery will occur.
  >>>>>>>>>>>>>>>> Exim pid=1261 terminating with rc=0 >>>>>>>>>>>>>>>>

It clearly says:

Condition is true: $local_part is root
Unseen save message to: /tmp/example_dir

However, nothing gets saved again.

OS: Debian 9.11 amd64.

I'd prefer to achieve this result using system filter, but any good solution would do really.

-1

It might not be the most elegant of solutions, but 'procmail' can do that. In the .procmail file for that user you create a copy:

:0 c
/var/mail/backup_file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.