Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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] to be piped through my script while messages to a regular user are not.

My setup is as follows;

I have a "parser" file: FILTER parser: FILTER parser: FILTER parser:

In I have either

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


smtp      inet  n       -       n       -       -       smtpd

and further down in

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

In 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 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, 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:,, 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=<> 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?

share|improve this question


check_recipient_access hash:/etc/postfix/parser, 

was below


and so was not being reached.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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