logging mail envelope

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

logging mail envelope

Matt Zagrabelny
Greetings!

I'm able to log the mail headers with:

/etc/postfix/header_checks
/to:/ WARN
etc.

and

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

How do I log envelope fields for received mail?

Thanks for any pointers!

-m


Reply | Threaded
Open this post in threaded view
|

Re: logging mail envelope

Bill Cole-3
On 2 Oct 2020, at 21:19, Matt Zagrabelny wrote:

> How do I log envelope fields for received mail?

Postfix logs the envelope sender and recipients by default. For example,
your message generated these 2 lines in my log:

Oct  2 21:19:27 bigsky postfix/qmgr[45059]: 4C38Cc621Yz4rbKG:
from=<[hidden email]>, size=6707, nrcpt=1 (queue
active)
Oct  2 21:19:27 bigsky postfix/local[80367]: 4C38Cc621Yz4rbKG:
to=<REDACTED@REDACTED>,
orig_to=<[hidden email]>, relay=local,
delay=2.8, delays=2.7/0/0/0.04, dsn=2.0.0, status=sent (delivered to
command:  /usr/bin/procmail -Y )

The first one shows the sender, the second shows the final local address
(redacted here, as it's a non-public address) and the original envelope
recipient that resulted in the delivery to that local address.

Rejected transactions will have somewhat different log entries, but if
they make it to the point of providing envelope addresses, those will
get logged in lines with 'from=' and 'to=' or sometimes 'orig_to='
denoting those addresses.

--
Bill Cole
[hidden email] or [hidden email]
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire