Linux – Postfix forward specific mails from HOLD queue

centos6linuxpostfixredhat

Is it possible in postfix to forward messages from the hold queue by referencing to them by their file name?

The best way would be by a terminal command.

Even better would be a python command.

If that's not possible editing the main.cf would be a considered option.

Background:

I have a python script which gives me a dynamic list of filenames of the mails in the hold queue which should be forwarded to a specific address for further examination before being delivered to their final destination.

e.g. of a file list from the hold queue

49C0B406D7

1F3BD40685

9F847406D8

61C63406D6

Best Answer

Just use shell command

postcat -qbh queueid | sendmail -f sender forward_address@example.com

Source: man postcat, man sendmail and this thread Postfix: change sender in queued messages

Related Topic