2

I'd like to know if it is possible to configure postfix to redirect to many email addresses (including the original recipient) instead of only one?

Here is my scenario: When an e-mail is:

Sent from: [email protected]

Addressed to: [email protected]

Result: redirect e-mail to [email protected] and deliver to the original recipient

The question is partly answered here: https://serverfault.com/questions/284702/redirect-specific-e-mail-address-sent-to-a-user-to-another-user

3
  • 2
    I don't know if postfix will duplicate mail for multiple users, but if you do not find a solution this is easily done with procmail (which gets run after postfix receives the mail)
    – Angelo
    Oct 20, 2014 at 13:52
  • 1
    I couldn't help thinking "mailing lists" when I read this question... Oct 20, 2014 at 16:15
  • thx Angelo. procmail did the trick.
    – harp
    Oct 21, 2014 at 11:21

2 Answers 2

1

Use an alias like this:

user: user, user2

According to the local(8) man page:

When an address is found in its own alias expansion, delivery is made to the user instead.

So you don't get infinite recursion.

1

I fixed the problem with procmail.

Source: http://www.netikka.net/tsneti/info/proctips.php#forward

Below is an example:

#Get the sender's bare email address from the first "From" line
FROM_=`formail -c -x"From " \
         | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g' \
         | awk '{ print $1 }'`

#Get the original subject of the email
#Discard superfluous tabs and spaces
#On some systems -xSubject: has to be -x"Subject: "
SUBJ_=`formail -c -xSubject: \
         | expand \
         | sed -e 's/  */ /g' \
         | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

#Whatever other recipes you'll use

:0
* ^From:.*infolist@([-a-z0-9_]+\.)*infohost\.infodom
# Avoid email loops
* ! ^X-Loop: myid@myhost\.mydom
{
  :0c:   #Preserve a copy of the email
  Infolist.mail
  :0fwh  #Adjust some headers before forwarding
  | formail -A"X-Loop: [email protected]" \
            -A"X-From-Origin: ${FROM_}" \
            -i"Subject: $SUBJ_ (fwd)"
  # Forward the email
  :0
  [email protected]
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .