在 Exim 中为特定收件人保存收到的邮件副本

在 Exim 中为特定收件人保存收到的邮件副本

我需要存档特定地址的重要邮件,以防它被意外从电子邮件服务器中删除等。

保存或使用管道将其存档在备份机器上都可以(我可以rsync稍后自动备份等)。

但是,我很难开始system_filter工作。到目前为止,我已经这样配置了它:

/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

/etc/exim4/system_filter

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

日志中没有写入任何内容,也没有保存任何内容(当然会发生正常传送)。

当我将$local_part系统过滤文件更改为root并像这样测试它时:

% exim  -bF /etc/exim4/system_filter -d-all+filter -f [email protected]  <tfpmet 
Exim version 4.89 uid=0 gid=0 pid=1261 D=200
...
Return-path taken from "Return-path:" header line
Return-path = [email protected]
Sender      = [email protected]
Recipient   = [email protected]
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 >>>>>>>>>>>>>>>>

它明确指出:

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

然而,什么都没有再被拯救。

操作系统:Debian 9.11 amd64。

我更愿意使用系统过滤器来实现这个结果,但任何好的解决方案都可以。

答案1

这可能不是最优雅的解决方案,但“procmail”可以做到这一点。在该用户的 .procmail 文件中创建一个副本:

:0 c
/var/mail/backup_file

相关内容