Azitech

Azimout's Linux weblog

Prepend label to message subject with Postfix

with 2 comments

So, you’re running Postfix on your home server and using a smarthost to forward those messages to your real email address. But you want to be able to somehow easily identify those messages, e.g. by prepending some sort of [MY_LABEL] to each message’s subject line.

To do that, use Postfix’s header_checks mechanism.

  1. Add the following line to your /etc/postfix/main.cf:
    header_checks = regexp:/etc/postfix/header_checks
  2. Create file /etc/postfix/header_checks with the following regular expression:
    /^Subject: (.*?)$/ REPLACE Subject: [MY_LABEL] $1
Advertisements

Written by azimout

02/01/2013 at 21:55

Posted in Howto

2 Responses

Subscribe to comments with RSS.

  1. Nice, easy-to-use writeup. Is there a way to add things like the current date to the subject? I’ve tried various combinations, but no luck…

    Griff

    27/05/2015 at 19:21

  2. Thanks a lot!

    Simon Elbaz

    26/01/2016 at 15:04


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: