how to send a copy to another email address of all incoming messages from an email account?(postfix)

21,806

Solution 1

You can simply use recipient_bcc_maps to copy all emails being sent to a specific user (or a specific domain).

For example add the following line to your main.cf (or use postconf for that):

recipient_bcc_maps = hash:/etc/postfix/recipient_bcc_maps

and create a file /etc/postfix/recipient_bcc_maps with the following content:

[email protected]  [email protected]

and run postmap recipient_bcc_maps.

Solution 2

You can do this by creating two aliases for the account, as follows:

Let's say you have two email addresses: [email protected] and [email protected], and you want mom to get a copy of all of kid's email. In this case, [email protected] and [email protected] would both be accounts, but you would also create the following aliases:

From:                         To:
[email protected]               [email protected]
[email protected]               [email protected]

Postfix will understand this -- the kid -> kid alias does not create a loop (though it looks like it should!), instead it tells Postfix to continue on to delivering to the mailbox even though the mail was already delivered to the alias.

Solution 3

one solution is to use procmail a different solution is to use ~/.forward file. over the two procmail has far more options and control.

Solution 4

I suggest using this milter if your postfix storage format is mbox: http://www.dancingfortune.com/projects/archivesmtp/index.php

the advantage is that if a user is authenticated and not using the proper from details his mail will still be caught by this milter while the sender_bcc_maps won't catch it.

Share:
21,806

Related videos on Youtube

Mrsksdk
Author by

Mrsksdk

Updated on September 18, 2022

Comments

  • Mrsksdk
    Mrsksdk almost 2 years

    how to send a copy to another email address of all incoming messages from an email account?(postfix)

    it's possible?

    thx.

  • Mrsksdk
    Mrsksdk about 13 years
  • silviud
    silviud about 13 years
    send bcc will do it as well ... :) there is also an option into main.cf
  • Mrsksdk
    Mrsksdk about 13 years
    could u tell me how to use this second option?
  • silviud
    silviud about 13 years
    check this link - is quite simple if you still have problems let me know - wiki.kartbuilding.net/index.php/Procmail_-_setup_with_postfi‌​x
  • Ludovic Kuty
    Ludovic Kuty about 12 years
    Note that postfix complains about a duplicate entry. Put both [email protected] and [email protected] destination on the same line.
  • ychaouche
    ychaouche over 6 years
    It surprisingly works.
  • Hasan
    Hasan over 4 years
    Works like charm. I've been looking for a solution to this problem for months.
  • user2965433
    user2965433 over 2 years
    And don't forget to issue 'service reload postfix' or 'systemctl reload postfix', whether your distro uses systemd or not. Otherwise postfix will not use the newly postmapped file