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')
/etc/postfix/virtual:
[email protected] support
/etc/postfix/aliases:
support: "|/opt/redmine-1.2.2/processemail.sh"
main.cf
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
processemail.sh:
#!/bin/sh
/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=<[email protected]>, 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?
Pipe Alias are implemented by local(8) postfix agent.
This means you are using the virtual(8) agent delivery to [email protected] 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:
This postfix-users thread and the postfix documentation may help.
You could use a simple alias in
/etc/aliases
(or wherever it is located):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; soyourscripthandler
should be something like: