I'm trying and failing to setup postfix so that inbound email to a specific address is piped through a script. It's all new to me, and I think I'm simply failing to understand the complexities of message routing.

I would like any messages for message+[code]@domain.com to be piped through my script while messages to a regular user are not.

My setup is as follows;

I have a "parser" file:

wanted@domain.com FILTER parser:
offered@domain.com FILTER parser:
message@domain.com FILTER parser:

In master.cf I have either

smtp      inet  n       -       n       -       -       smtpd  -o content_filter=parser


smtp      inet  n       -       n       -       -       smtpd

and further down in master.cf

parser     unix -        n       n       -       -       pipe
   user=virtual argv=/bin/bash /usr/local/bin/parser.pl

In main.cf I have

smtpd_recipient_restrictions =  check_client_access hash:/etc/postfix/rbl_override,
                            check_recipient_access hash:/etc/postfix/parser,

The problem that I'm having is that if, in master.cf I have "-o content_filter=parser" then all mail is directed to the parser and not just the mail destined for the accounts that I've configured.

If i remove "-o content_filter=parser" then no email is parsed and all email is delivered to accounts in the normal way.

So my question is, how do I configure postfix to query and use the parser file I've created to determine which addresses it should pipe through my script?

I've tried to keep info brief for people, however I'm happy to post full configs or other files if that is preferred?

Logs - this is mail being delivered locally;

Nov 1 08:46:02 fadmin lt-opendkim[2243]: 2B589746B4D: DKIM-Signature header added (s=mail, d=domain.com) Nov 1 08:46:02 fadmin postfix/qmgr[14679]: 2B589746B4D: from=, size=2626, nrcpt=1 (queue active) Nov 1 08:46:02 fadmin clamsmtpd: 10005A: from=mark@domain.com, to=message+bXLxWD@domain.com, status=CLEAN Nov 1 08:46:02 fadmin postfix/smtp[14693]: D3C98746A47: to=, relay=[]:10025, delay=0.42, delays=0.26/0.01/0.05/0.1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 2B589746B4D) Nov 1 08:46:02 fadmin postfix/smtpd[14695]: disconnect from localhost[] Nov 1 08:46:02 fadmin postfix/qmgr[14679]: D3C98746A47: removed Nov 1 08:46:02 fadmin postfix/virtual[14697]: 2B589746B4D: to=, relay=virtual, delay=0.11, delays=0.1/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir) Nov 1 08:46:02 fadmin postfix/qmgr[14679]: 2B589746B4D: removed

This is mail being delivered to my script

Nov 1 07:52:46 fadmin postfix/smtpd[11557]: connect from six.localdomain[] Nov 1 07:52:46 fadmin postfix/smtpd[11557]: 5CB27746849: client=six.localdomain[] Nov 1 07:52:46 fadmin postfix/cleanup[11559]: 5CB27746849: message-id=<32916A3D-6CAB-463F-8F36-794DFC59302C@domain.com> Nov 1 07:52:46 fadmin lt-opendkim[2243]: 5CB27746849: six.localdomain [] not internal Nov 1 07:52:46 fadmin lt-opendkim[2243]: 5CB27746849: not authenticated Nov 1 07:52:46 fadmin postfix/qmgr[11528]: 5CB27746849: from=, size=2518, nrcpt=1 (queue active) Nov 1 07:52:48 fadmin postfix/pipe[11560]: 5CB27746849: to=, relay=parser, delay=2.1, delays=0.26/0.01/0/1.8, dsn=2.0.0, status=sent (delivered via parser service) Nov 1 07:52:48 fadmin postfix/qmgr[11528]: 5CB27746849: removed

Happy to send more logs and files. please tell me what's relevant?


in main.cf

check_recipient_access hash:/etc/postfix/parser, 

was below


and so was not being reached.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.