...or:
do this:
create a mail forwarder like this:
support@exmaple.com >> |/usr/local/lib/php -q /absolute-path-to-script/support-reply.php
The "-q" is telling php not to output anything and run in quiet mode, if you do not inclue this, you will get a mail delivery error.
Make absolutely sure you include the pipe "|" at the beginning, this is telling exim to "pipe" the email to a script.
Then, go into your exim.conf file, this should be in /etc and add this:
or make it look like this if this code already exists:
address_pipe:
driver = pipe
pipe_as_creator
...this ensures the page is email is sent to the page and does not generate an error.
(there is a tutorial on the web that does not quite explain this clearly.)
Then use this code on your page to pick up the email:
// read from stdin
$fd = @fopen("php://stdin", "r");
$email = "";
while (!@feof($fd)) {
$email .= @fread($fd, 1024);
}
@fclose($fd);
// handle email
$lines = explode("\n", $email);
// empty vars
$from = "";
$subject = "";
$headers = "";
$message = "";
$splittingheaders = true;
for ($i=0; $i < count($lines); $i++) {
if ($splittingheaders) {
// this is a header
$headers .= $lines[$i]."\n";
// look out for special headers
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."\n";
}
if (trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}
Hey presto, now you have a working email trigger php program, do what you will with it.
Of course, the pop3 option is better if you are just trying to retrieve emails.
What I've said here is based on this tutorial:
http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.html
But some of what he said did not work on my Cpanel server.