How can we help?




Follow

Copy all mail for specific accounts via Exim

Stewart -

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

  1. Open and edit /var/lib/atmail/mailserver/roles/ss1ip/templates/exim/exim.conf.j2
  2. 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 }}
  3. 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 }}
  4. Save changes and exit.
  5. Create /etc/exim/atmail.filter
  6. 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    
  7. 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
  8. Save changes and exit.
  9. Go to webadmin > Services and press Publish config.
  10. Restart exim services.
    systemctl restart exim
  11. Copying will be now setup for the accounts specified.
  12. 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.

 

Have more questions? Submit a request

Comments


Contact our support team


+61 (7) 5357 6605       support@atmail.com