I have no idea about Mail Delivery.
but i need redirect ALL incoming e-mail (*@mydomain.com) into an a php script.
i'm using debian
Exists a simple mail server to do this? (without exim, postfix, etc)
i only need redirect all mail request.
if this is not possible without exim, postfix, etc. how can i do this?
thanks!
Best Answer
When you say "a PHP script" do you mean a PHP script on a webserver elsewhere, or a PHP script run on the command line locally?
I've done sending the mail to a website elsewhere using exim4 and curl, by creating a custom transport like so:
If you are using Debian's "split configuration" option, you would create a file in
/etc/exim4/conf.d/transport/
with this in it. Thecommand
here will pass the entire email (headers and body) tomail.php
in the variable$_REQUEST["mail"]
. You'll need to have your PHP script handle the headers.To trigger the transport you'll need to have a
router
configured that matches whatever email you want to receive and uses the abovetransport
to send it. With split configuration, routers go in/etc/exim4/conf.d/router/
. For capturing ALL the mail for a specific domain, I haven't tested this but I think this is right:Debian numbers the files in the router directory to set the order routers are checked in. The first matching router will be used to handle the email. From my configuration here, you'd probably want to number yours around 450 to go after aliases and before the routers that handle local users like
hubusers
andprocmail
.After adding these files to the transport and router directories, you will need to run
update-exim4.conf
to have Debian create the configuration file exim actually reads.