How often does the letter r occur in:
Q: How to route email to a script What Id like to do is set up an address like something@myhost.com which will take whatever email it gets and run the full message as STDIN into a shell script. I cant seem to get this working though. Tried a couple solutions, including this one:
How can I route some emails to a script in Postfix?
But my setup is a bit different. Ive got the Postfix/Dovecot/MySQL setup, so all email is handled by Dovecot, and Postfix reads its maps from MySQL. Whatever I add to master.cf doesnt seem to work. SpamAssassin has a line in there and thats working fine. Im stuck!
EDIT:
I really wish people would read carefully before downvoting my question. I am using MySQL for my alias maps, so /etc/aliases does not work, I already tried that of course.

A: Obviously will work Douglas Lands answer, with a little addition.
Suppose you have only localhost.localdomain at $mydestination in main.cf.
Then add a virtual alias :
something@myhost.com -> somelocaluser@localhost.localdomain

In main.cf you will need:
alias_maps=hash:/etc/aliases

Then add to /etc/aliases :
somelocaluser: |/your/script/here

newaliases+postfix reload and you are good to go.

A: You can pipe an entry to a script via /etc/aliases, RE:
foo: |/your/script/here

modify /etc/aliases then run newaliases and reload the postfix process. 

A: Id go with Procmail. We use this to parse all sorts of mail out to worker scripts and IRC bots for notifications.
Here is an example of how to handle email.
http://linuxgazette.net/issue14/procmail.html
Relevant short example done here for ease:


*

*Create a local user called handler, for example.

*Go to handlers home directory and create a file called .procmailrc containing:

:0
| $HOME/bin/my.script


This will pass the entire inbound email to the script $HOME/bin/my.script through STDIN.
Also here is where I got help with Procmail when I was first trying to pass email to a script: How to use procmail to get a message into a variable

A: I would check if sieve supports piping to a script. Dovecot supports sieve scripts.
As alternative you can use procmail as MDA between postfix an dovecot. Procmail can pipe to a script. 
(that said I wonder why Douglas Lands answer does not work, mysql as backend should not make a different?!)

A: Something that hasnt been mentioned is that you can use more than one lookup table (separated by comma or space):
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf
alias_maps = mysql:/etc/postfix/mysql-aliases.cf hash:/etc/aliases

The first one (virtual_alias_maps), will search for an email and return a username (for example: info@example.com -> info1234). 
Then, the second one (alias_maps) will search for a username in your database, if not found, will search it at /etc/aliases. This way, you can still manage your aliases in MySQL and set your scripts in /etc/aliases, and no need to append @localhost.localdomain to the local users.
To test if your setup is correct, use:
postmap -q info@example.com mysql:/etc/postfix/mysql-virtual.cf
postmap -q info1234 mysql:/etc/postfix/mysql-aliases.cf hash:/etc/aliases

Using Local accounts with aliases in MySQL:
In one of my custom setups, Im using local accounts for users and MySQL for aliases only. So this is how I set it:
virtual_alias_maps = hash:/etc/postfix/vusers
smtpd_sender_login_maps = hash:/etc/postfix/vusers
virtual_alias_domains = /etc/postfix/vhosts
alias_maps = mysql:/etc/postfix/mysql-aliases.cf hash:/etc/aliases

As you can see, feel free to mix them anyway you want.

user
There are 130 "r"s.
assistant