Tuesday, December 25, 2007

Exim divide incoming and outgoing mail

If you want route all incoming mail to pipe for example php file and route all outgoing mail to remote smtp.
edit your exim.conf file
In routers configurations block insert it:
------------------
begin routers
# Remote addresses are those with a domain that does not match any item# in the "local_domains" setting above.
# This router routes to remote hosts over SMTP using a DNS lookup. Any domain# that resolves to an IP address on the loopback interface (127.0.0.0/8) is# treated as if it had no DNS entry.
manualroute: driver = manualroute# condition = ${if or{{eq{$sender_host_address}{127.0.0.1}} {eq{$sender_host_address}{NULL}}}{yes}{no}}# condition = ${if eq{$sender_host_address}{127.0.0.1}{1}{0}}condition = ${if match_ip{$sender_host_address}{:127.0.0.1}}route_list = !+local_domains mxout.qos.net.il transport = remote_smtp no_more

lookuphost: driver = dnslookup domains = ! +local_domains ignore_target_hosts = 127.0.0.0/8 condition = "${perl{check_limits}}"# transport = remote_smtp transport = mypipe_smtp no_more

--------------------------
In transports Configurations block insert:

--------------------------
begin transports
mypipe_smtp: driver = pipe command = "/usr/local/bin/php /tmp/1.php" use_bsmtp = true user = mail group = mail

No comments: