PROBLEM
I want to be able to copy all mail for a/some specific account/s via Exim.
ENVIRONMENT
- atmail mail server
CAUSE
Copy emails requirement.
RESOLUTION
- Open and edit
/var/lib/atmail/mailserver/roles/ss1ip/templates/exim/exim.conf.j2
- Locate
###
### Start: main-cfg.j2 #############################################################
###
daemon_smtp_ports = 25{% if exim_smtps_enable|int == 1 %}:465{% endif %}{% if exim_submission_enable|int == 1 %}:587{% endif %}
local_interfaces = {{ exim_local_interfaces }} - Change to
###
### Start: main-cfg.j2 #############################################################
###
###
###<SYSTEM FILTER FOR SINGLE USERS EMAIL COPYING>
###
system_filter = /etc/exim/atmail.filter
system_filter_user = atmail
system_filter_group = atmail
###
###</SYSTEM FILTER FOR SINGLE USERS EMAIL COPYING>
###
daemon_smtp_ports = 25{% if exim_smtps_enable|int == 1 %}:465{% endif %}{% if exim_submission_enable|int == 1 %}:587{% endif %}
local_interfaces = {{ exim_local_interfaces }} - Save changes and exit.
- Create
/etc/exim/atmail.filter
- Edit
/etc/exim/atmail.filter
and add
# don't want to get multiple copies
if first_delivery
and (("$h_to:, $h_cc:" contains "user1@domain.com")
or ("$h_from:" contains "user1@domain.com"))
then
unseen deliver "copy@domain.com"
endif - Add new block for each account you want to archive.
# don't want to get multiple copies
if first_delivery
and (("$h_to:, $h_cc:" contains "user1@domain.com")
or ("$h_from:" contains "user1@domain.com"))
then
unseen deliver "copy@domain.com"
endif
if first_delivery
and (("$h_to:, $h_cc:" contains "user2@domain.com")
or ("$h_from:" contains "user2@domain.com"))
then
unseen deliver "copy@domain.com"
endif
if first_delivery
and (("$h_to:, $h_cc:" contains "user3@domain.com")
or ("$h_from:" contains "user3@domain.com"))
then
unseen deliver "copy@domain.com"
endif - Save changes and exit.
- Go to webadmin > Services and press Publish config.
- Restart exim services.
systemctl restart exim
- Copying will be now setup for the accounts specified.
- Note, the maildir directory should be backed up via cron each month and automatically pruned of messages. Otherwise the performance can decrease if the directory contains a large number of messages.
Comments