UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: info@upwork.link

Log Subject Lines in Postfix

without comments

Postfix does allow you to add logging messages for subject lines, and so we’ll use this to simply log a warning message for any subject line. It’s a bit of a ‘hack’, but works and doesn’t cause any problems (Postfix doesn’t block or alter the emails).

1. Edit the main.cf:

header_checks = pcre:/etc/postfix/header_checks.pcre

2. Create the /etc/postfix/header_checks.pcre file and add the following line:

/^Subject:/ WARN

3. Reload Postfix and send a test message.

# egrep Subject maillog
May 12 20:36:08 odesk postfix/cleanup[2155]: C6D604B005EB: warning: header Subject: Test from local; from= to=
May 12 20:36:50 odesk postfix/cleanup[2155]: 3F9C24B00607: warning: header Subject: HEADER_CHECKS from local; from= to=

Now, every subject line will be logged 🙂 It makes life a lot easier when doing email troubleshooting on a mail server. Note that newer versions of Postfix support ‘INFO’ as well as ‘WARN’, so you may prefer using that instead.

Written by spectre

May 12th, 2014 at 12:11 pm

Posted in Postfix & Amavis

Leave a Reply

*