Store and forward mail but change FROM header in forwarded mail

5,234

I managed to solve it by using this recipe, and I also added a line that changes the From: address for the system where we forward it to

# store mail in default folder and continue after that
:0c
${DEFAULT}

# change header
:0fhw
| formail -i "From: [email protected]"

# forward mail
:0
! [email protected]
Share:
5,234
datadevil
Author by

datadevil

Updated on September 18, 2022

Comments

  • datadevil
    datadevil almost 2 years

    I need a procmail recipe which stores the mail and forwards it to another address.

    The following works fine:

    :0c
    ! [email protected]
    

    But..now I need to change the From: header in the mails that are being forwarded, and I know it can probably be done with formail but I failed to find any good examples on how to do that and still store the email

    EDIT: solved it myself, see the answer below