Server Fault is a question and answer site for system and network administrators. 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 have a postfix mail server (on and if I send a mail to I want to check the content of the mail, add some extra info and resend it somewhere else, (sms gateway email or so..)

Is something like that possible with postfix? thanks.

share|improve this question
Check out procmail – Warner Mar 29 '10 at 13:38
up vote 0 down vote accepted

Or you couyld make an alias to a script,

you could put into /etc/alias something like     "|/usr/local/"

and create a script that parses Standard input using: MIME::Parser, Email::Simple and your favourite perl modules... or any other language of your choice... The script could then email the result, call any sms web gateway, etc...

share|improve this answer

Yeah, you could do it with Postfix. Essentially you want to put any messages to into a quarantine for processing which would be essentially putting it into the HOLD queue in postfix for processing.

There is probably a better lookup table to use, but, you could test with header_checks postfix file. /etc/postfix/header_checks - You could make this check for TO: and send to HOLD queue (note... there is probably faster/better lookup table for this)

If you read the comments in the header_checks file for HOLD it says...

#               Arrange  for  the  message to be placed on the hold
#               queue, and inspect the next input line.   The  mes-
#               sage  remains  on hold until someone either deletes
#               it or releases it for delivery.
#               Mail that is placed on hold can  be  examined  with
#               the  postcat(1)  command,  and  can be destroyed or
#               released with the postsuper(1) command.
#               Note: use "postsuper -r" to release mail  that  was
#               kept  on  hold for a significant fraction of $maxi-
#               mal_queue_lifetime  or  $bounce_queue_lifetime,  or
#               longer.

Would mean logging in and manually checking the emails in the hold queue by command line, but, pretty much what you want?

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.