I'm trying to setup exim4 on the server, so that it can receive mail for a couple sub domains, and I want to pipe that to a PHP script. I want all incoming mail to be processed through my custom script (PHP).
I posted some of my setting details below. I'm fairly new to setting this up, so I'm sorry if I'm totally off.
I've tried the following command, and it didn't seem to do anything. I couldn't see any new mail in /var/mail
, and the PHP script didn't seem to be hit.
echo "This is a test." | mail -s Testing [email protected]
Here's the custom router, in exim4.conf
:
cmd_router:
driver = accept
domains = +local_domains
transport = cmd_transport
no_verify
Here's the transport, in exim4.conf
:
cmd_transport:
debug_print = "T: using cmd_transport"
driver = pipe
command = /dir/to/php_mailer.php
delivery_date_add
envelope_to_add
Here's the update-exim4.conf.conf
file:
dc_eximconfig_configtype='internet'
dc_other_hostnames='QAnetwork ; sub1.domain.net ; sub2.domain.net ; localhost'
dc_local_interfaces='127.0.0.1 ; 127.0.1.1 ; 123.123.123.123(server's external ip)'
dc_readhost='QAnetwork ; sub1.domain.net ; sub2.domain.net'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
* Update *
I've been monitoring the exim4 mainlog after running the echo mail command, and getting the following:
2014-07-03 14:39:45 1X2lv7-0004mg-9Q <= root@ETC_MAILNAME U=root P=local S=488
2014-07-03 14:39:45 1X2lv7-0004mg-9Q ** [email protected]: Unrouteable address
2014-07-03 14:39:45 1X2lv7-0004mk-Br Error while reading message with no usable sender address (R=1X2lv7-0004mg-9Q): at least one malformed recipient address: root@ETC_MAILNAME - malformed address: _MAILNAME may not follow root@ETC
2014-07-03 14:39:45 1X2lv7-0004mg-9Q Process failed (1) when writing error message to root@ETC_MAILNAME (frozen)
I'm not really sure what to make of that error. I did some looking into the 'unrouteable address' error, but couldn't get it working.
Any ideas?