If you want to log the Subject during the SMTP delivery (will appear as 
<timestamp> <hostname> postfix/smtp log):

 

main.cf:

smtp_header_checks = pcre:/etc/postfix/header_smtp.pcre

 

header_smtp.pcre:

/^Subject: / info

 

 

 

From: owner-postfix-us...@postfix.org [mailto:owner-postfix-us...@postfix.org] 
On Behalf Of Olivier CALVANO
Sent: Sunday, April 19, 2015 11:18 AM
To: phil
Cc: postfix-users
Subject: Re: Add subject in logs or into a file ?

 

Thanks i test today ;=)

 

2015-04-19 7:27 GMT+02:00 phil <p...@philfixit.info>:

On 19/04/2015 3:21 PM, Olivier CALVANO wrote:

Hi

Actually, i have a Postfix server and into the logs i have:

Apr 14 20:06:00 mx postfix/smtpd[24600]: 01BF8301079A:
client=o1.email.xx.com <http://o1.email.xx.com>[192.xx.xx.153]
Apr 14 20:06:00 mx postfix/cleanup[24932]: 01BF8301079A:
message-id=<14cb9189909.2c84.ab5ac@ismtpd-061>
Apr 14 20:06:00 mx postfix/qmgr[20732]: 01BF8301079A:
from=<bounces+701539-9339-xx=xx...@email.xx.com
<mailto:xx...@email.xx.com>>, size=18397, nrcpt=1 (queue active)
Apr 14 20:06:01 mx postfix/smtp[24933]: 01BF8301079A: to=<myu...@xx.fr
<mailto:myu...@xx.fr>>, relay=spam.mydomain.org
<http://spam.mydomain.org>[2a02:xx:xx:X:X::400]:25, delay=1.5,
delays=0.92/0.04/0.16/0.34, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued
as BDE043004F53)
Apr 14 20:06:01 mx postfix/qmgr[20732]: 01BF8301079A: removed



I am search a solution for put into the logs the subject of the mail.
Directly into the logs, sample:
    Apr 14 20:06:01 mx postfix/smtp[24933]: 01BF8301079A: subject=test
logs subject

or into a separate file, sample:
    01BF8301079A;test logs subject;

it's possible ?

regards
Olivier


You can do a header check with a regexp in main.cf . . .

header_checks = regexp:/etc/postfix/header_checks

and in that file put something like . . .

/^Subject: / WARN

regards
phil

 

Reply via email to