This is only for logging message headers.
By default postix already logs most of this information, though not in one line. It doesn't, however, log the subject or message-id. We can add that in by using header_checks 5
.
Note: for all mail and not just outgoing, use header_checks
instead of smtp_header_checks
.
#main.cf
smtp_header_checks = regexp:$config_directory/header-logging.cf
#header-logging.cf
/^subject:/ INFO
/^Subject:/ INFO
/^Message-Id:/ INFO
These messages will be logged to syslog in the facility specified by syslog_facility
(default: mail)
.
Apr 9 15:37:25 mta-msa postfix/smtps/smtpd[14688]: DA75A231C600: client=192-0-2-5.example.com[192.0.2.5], sasl_method=LOGIN, sasl_username=foo
Apr 9 15:37:25 mta-msa postfix/cleanup[14686]: DA75A231C600: message-id=<000401d07315$bf0ea5a0$3d2bf0e0$@example.com>
Apr 9 15:37:25 mta-msa postfix/qmgr[14653]: DA75A231C600: from=<foo@example.com>, size=6495, nrcpt=1 (queue active)
Apr 9 15:37:26 mta-msa postfix/smtp[14675]: DA75A231C600: info: header Subject: RE: please email as you leave
Apr 9 15:37:26 mta-msa postfix/smtp[14675]: DA75A231C600: info: header Message-ID: <000401d07315$bf0ea5a0$3d2bf0e0$@example.com>
Apr 9 15:37:26 mta-msa postfix/smtp[14675]: DA75A231C600: to=<bar@example.org>, relay=mx.example.org[198.51.100.0]:25, delay=0.65, relays=0.01/0/0.33/0.31, dsn=2.0.0, status=sent (250 2.0.0 1tnx2ya0mh-1 Message accepted for delivery)
Apr 9 15:37:26 mta-msa postfix/qmgr[14653]: DA75A231C600: removed