Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get or catch email bodies and headers sent by postfix

I need catch email bodies and headers that are sent by postfix on my Ubuntu server.

Could you please explain me, how to catch it?

I know I can do it by postcat (postcat -vq XXXXXXXXXX) when message is in mail queue, but unfortunately I don't know queue ID (XXXXXXXXXX) and when I find it, message is already sent.

like image 250
JEROME Avatar asked Jan 10 '23 11:01

JEROME


1 Answers

  1. send email
  2. stop postfix
  3. get queue ID
  4. postcat -vq ID

for example:

echo "test message" | mail -s "test" [email protected]
service postfix stop
mailq
postcat -vq C23D82B60024
like image 57
JEROME Avatar answered Jan 12 '23 01:01

JEROME