mail archiving bug or feature?

Discussion in 'General' started by nulledp, Jul 27, 2018.

  1. nulledp

    nulledp New Member

    Hello to everyone

    I'm trying to do full mail archiving and i think my server behave strange.

    For example:
    I have
    - domain1
    and mailboxes
    - mailbox1@domain1
    - mailbox2@domain1
    - mailarchivemailbox@domain1

    Inside mailbox1@domain1 and mailbox2@domain1 I set up mailarchivemailbox@domain1 as "Send copy to" and "Send outgoing BCC to"
    mailarchivemailbox@domain1 receiving 3 identical email to INBOX when mailbox1 sends email to mailbox2
    But when mailbox1@domain1 sends email to not localdomain - everything works fine.

    Then I added line to master.cf like this to avoid double messages but it doesn't work.
    Code:
    smtps     inet  n       -       -       -       -       smtpd
      -o receive_override_options=no_address_mapping
    
    Please anyone give me any suggestions?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This is what happens when you send an email from a to b where both are local domains in the setup you made:

    1) There is the original mail which will go from A into mailbox b.
    2) You configured outgoing bcc, so during sending, a copy is sent to the archive.
    3) As you configured incoming copy, another copy of the mail is sent to the archive during receiving.

    Sending and receiving are two different actions and as you configured your system to create a copy during send and another during receiving, you must end up with 3 copies of this email on your server.

    Postfix can not deduplicate the email as the send copy to is done by dovecot and not postfix.
     
  3. nulledp

    nulledp New Member

    A -> B send = 1st mail in archive
    B received mail from A = 2nd mail in archive
    where is from 3rd email in archive?

    I can't understand a logic
    excuse me

    is there some mechanism or trick to kill duplicates in mailarchivemailbox@domain1 ?
    is it possible to modify logic to kill duplicate mail if sender and receiver are local domain mailboxes?
     
  4. nulledp

    nulledp New Member

    Please mark thread as SOLVED probably it will help someone.

    In file /etc/postfix/main.cf I changed line:
    Code:
    sender_bcc_maps = proxy:mysql:/etc/postfix/mysql-virtual_outgoing_bcc.cf
    to
    Code:
    sender_bcc_maps = hash:/etc/postfix/sender_bcc
    and added line:
    Code:
    recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
    and created two files with text inside:
    /etc/postfix/recipient_bcc
    Code:
    mailbox1@domain1 mailarchivemailbox@domain1
    mailbox2@domain1 mailarchivemailbox@domain1
    /etc/postfix/sender_bcc
    Code:
    mailbox1@domain1 mailarchivemailbox@domain1
    mailbox2@domain1 mailarchivemailbox@domain1
    after that reindex hash files
    Code:
    postmap /etc/postfix/recipient_bcc
    postmap /etc/postfix/sender_bcc
    and restart services or reboot server:
    Code:
    systemctl restart dovecot postfix
     
  5. florian030

    florian030 Well-Known Member HowtoForge Supporter

    Personally, i would add this to postfix cleanup-service.
    Code:
    cleanup   unix  n       -       -       -       0       cleanup
      -o sender_bcc_maps=hash:/etc/postfix/archive_maps
      -o recipient_bcc_maps=hash:/etc/postfix/archive_maps
    
    /etc/posfix/archive_maps:
    Code:
    @domain [email protected].
    
     
    Jesse Norell likes this.

Share This Page