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.

I tried following the tutorial at: http://www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP.html to pipe incoming mail to a PHP script for a virtual host with Exim. I can't seem to get it working. Any ideas?

Here's my exim.conf setup:


I have created the directory:


And created a file: ysend.com in it, with:

catch-all: |php -q /home/ysend/public_html/handler.php

I also tried:

*: |php -q /home/ysend/public_html/handler.php

As well as:

catch-all: my.email.address@site.com


*: my.email.address@site.com

share|improve this question

1 Answer 1

up vote 1 down vote accepted

try a

exim -bt someaddress@site.com

Exim is quite talky about what it is doing.

You may add the following line to your exim.conf main section

trusted_users = yourapacheuser

(apacheuser may be www-data on debian/ubuntu, httpd on redhat/fedora)

and most importantly: move your vhost_alias from routers to directors. routers are for mails sent offsite, directors on how to handle local mails.

share|improve this answer
For the command: [root@server ~]# exim -bt test@ysend.com Zhay07@gmail.com <-- test@ysend.com router = dnslookup, transport = remote_smtp host gmail-smtp-in.l.google.com [] MX=5 host alt1.gmail-smtp-in.l.google.com [] MX=10 host alt2.gmail-smtp-in.l.google.com [] MX=20 host alt3.gmail-smtp-in.l.google.com [] MX=30 host alt4.gmail-smtp-in.l.google.com [] MX=40 And trusted_users = apache is already there :) Where is the directors section? Do I have to create it? –  John Jun 26 '09 at 20:11
When I change the /etc/exim/vhosts/ysend.com file so that it says: catch-all: |php -q /home/ysend/public_html/handler.php and I run the exim -bt test@ysend.com command, it says: Unrouteable address –  John Jun 26 '09 at 20:22
I switched it from catchall to *, and now I get: [root@server ~]# exim -bt lol@ysend.com lol@ysend.com -> |php -q /home/ysend/public_html/handler.php transport = address_pipe –  John Jun 26 '09 at 20:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.