Reputation: 149
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.
Upvotes: 4
Views: 8463
Reputation: 1693
if you want to pause delivery of mail to other servers, you could defer smtp transport, do the deed and then undefer it. You will stil get mail delivered to you from other servers.
sudo postconf -e defer_transports=smtp; sudo postfix reload
echo "test message" | mail -s "test" [email protected]
mailq
postcat -vq C23D82B60024
sudo postconf -e defer_transports=; sudo postfix reload; sudo postfix flush
source: nixtips.net
Upvotes: 2
Reputation: 149
for example:
echo "test message" | mail -s "test" [email protected]
service postfix stop
mailq
postcat -vq C23D82B60024
Upvotes: 8