> 2) Create a script where mail can be piped to.  This is a method that I
> have used previously with a cgi app called PerlDesk.

In answer to Point 2...

If you are in a position to edit your 'aliases file' you can feed email to a
program using PHP quite easily. I am doing it and works quite well.

So, 1st, edit your file (generally in /etc/mail/aliases) and add the line:

testit: "|/usr/local/bin/php /path/to/your/php/file/processmail.php"

(making sure this is the path to php etc)

Below is an example how to capture the mail, the following simply reads the
email into $buffer and emails it, this should hopefully point yu in the
right direction...

<?php
define('STDIN',fopen("php://stdin","r"));
$str = fgets(STDIN);
$fp = popen('cat /dev/fd/0','r');
while(!feof($fp)) {
 $lines = fgets($fp,4096)."\n";
}
$handle = STDIN;
while (!feof ($handle)) {
    $buffer .= fgets($handle, 4096);
    echo $buffer;
}
fclose ($handle);
mail("[EMAIL PROTECTED]","Test","Test Test...\n\nOriginal Email:\n\n$buffer");
?>

- Brian M McGarvie - IT Manager (e-loanshop.com).
- www.devdojo.com (Developer Community)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to