Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

We receive service requests via a particular email. The request is then forwarded to other addresses, using an entry in virtual_alias_maps. Upon seeing the word "EMERGENCY" in the subject line of a request to this email, I would also like to forward this to another address (an alias of our administrator's SMS email addresses).

I think I can accomplish this with header checks and the REDIRECT command. However, REDIRECT only sends it to the redirected address, not the forwarded addresses. In the case of "EMERGENCY" I would like it to go to the redirect address and the original forwarded addresses.

I am fairly new to Postfix and I feel like I am missing something here. Any suggestions?

share|improve this question
I'm more of a QMAIL sort of guy but this sounds like a job for procmail. – Warner Apr 8 '10 at 15:46
up vote 0 down vote accepted

Typically, Postfix won't act upon the message contents without outside help, it acts on the envelope information. Things like the Subject belong to the message contents.

I think the easiest way to manage such things is to include an extra email address to the ones already receiving, which is actually a forward to a script (you can do that in /etc/aliases by prefixing the destination with a pipe symbol, read man aliases) that performs your requested tests on its standard input (the message contents) and acts accordingly.

share|improve this answer

this can be done by:

a.) add a new smtpd listener to setting the -o always_bcc option to the address you want and have this new smtpd process listen on some port like 10027; create a second smtpd listener on 10028 - set options in this smtpd instance for delivery to final destinations as you would a standard smtpd instance. See for more info

b.) in your header check, use the filter action and send any matching subject to filter inet:

alternately, you could install an additional postfix instance and route messages to that via step a as well ... many different ways to do this.

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.