Postfix rule rewrite mail body

Discussion in 'Installation/Configuration' started by Pantos21, Mar 19, 2020.

  1. Pantos21

    Pantos21 New Member

    Dear all, I am planning to install postfix as mail relay just to do something that cannot be done with Microsoft exchange I have now and I don't know if can be done with postfix. I want to create a rule that can copy the whole subject of the email to the body of the email automatically and then send it out. Is that possible ? I read about content inspection header_check and body_check but does anyone have experience and help me how to do it?

    Regards
    Pantos
     
    Last edited: Mar 19, 2020
  2. Steini86

    Steini86 Active Member

    While is easy to change headers with Postfix, changing something in the body of an email is another topic. Usually that is prevented for good reasons: It is difficult with mime mails, it breaks dkim, it might (in some countries) be illegal to alter the body of a message, etc...
    Easiest solution is to use a "content filter": http://www.postfix.org/BUILTIN_FILTER_README.html
    Postfix forwards the message to this content filter and this can do everything (for example used for spam detection, dkim signing, etc..). Then you could use a simple python/perl script to do the changes you want.
    http://www.postfix.org/header_checks.5.html
     

Share This Page