Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How to configure postfix to pipe all incoming email to a script?

I'm having problems setting up simple piping for Redmine (or '|cat > /tmp/temp')


support@myhost.com support


support: "|/opt/redmine-1.2.2/processemail.sh"


virtual_alias_maps = hash:/etc/postfix/virtual, mysql:/etc/postfix/mysql_virtual_forwards.cf
virtual_mailbox_domains = myhost.com, mysql:/etc/postfix/mysql_virtual_domains.cf
virtual_mailbox_maps = hash:/etc/postfix/virtual_alias, mysql:/etc/postfix/mysql_virtual_mailboxes.cf

alias_maps = hash:/etc/postfix/aliases
alias_database = $alias_maps


/opt/redmine-1.2.2/extra/mail_handler/rdm-mailhandler.rb --url http://myhost.com --key f5obfctmGfqZWnOWNtR8 --project test --tracker support --allow-override tracker,project --verbose --unknown-user accept --no-permission-check

I've run newaliases; postmap virtual; postalias aliases; postalias virtual_alias; newalias - Yeah, probably overdoes it, but still misses the pouint :(

I've run newaliases and restarted postfix. Mail is delivered as usual, but nothing is added to /tmp

This is the only log entry saying anything about virtual.

Dec 10 04:08:41 master postfix/virtual[3112]:
A3F46AD1BF: to=<support@myhost.com>, relay=virtual, delay=0.4,
delays=0.38/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)

If I run cat someemail | processemail.sh in the shell, everything works. Processemail isn't even run by postfix.

Anyone knows what might be wrong? Or how I can turn on more logging?

share|improve this question

marked as duplicate by mailq, Ward, Chris S, Scott Pack, MDMarra Dec 11 '11 at 15:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Yes, an exact duplicate. I just found a solution and was posting it the same second the question was closed :) Would have saved a couple of hours if I found that answer first. –  simendsjo Dec 11 '11 at 15:11

2 Answers 2

Pipe Alias are implemented by local(8) postfix agent.


This means you are using the virtual(8) agent delivery to support@myhost.com but you need local(8) to fetch that email. Maybe you using virtual as your local_transport or you need to put in your 'virtual_alias_maps' file something like:

support@myhost.com support@localhost

This postfix-users thread and the postfix documentation may help.

share|improve this answer

You could use a simple alias in /etc/aliases (or wherever it is located):

support: |/usr/local/bin/yourscripthandler

Don't forget to run newaliases afterwards.

Note that redirection (>/tmp/blah) is something handled by the shell, and AFAIK postfix won't invoke a shell to run your command; so yourscripthandler should be something like:

/usr/local/bin/theactualscripthandler >/tmp/dummy
share|improve this answer
Isn't that exactly what I'm doing above? –  simendsjo Dec 10 '11 at 11:01
You're absolutely right. Sorry, I'll expand my answer. –  ΤΖΩΤΖΙΟΥ Dec 10 '11 at 11:02

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