#!/usr/bin/php -q . */ preg_match("/([a-zA-Z0-9\.\/]*)\/([a-zA-Z0-9]+).([a-zA-Z0-9]+)/",$_SERVER['SCRIPT_NAME'],$matches); $INCLUDE_INCLUDE=$matches[1]."/".$matches[2]."_include.".$matches[3]; $INCLUDE_ERROR=$matches[1]."/".$matches[2]."_error.".$matches[3]; include($INCLUDE_INCLUDE); // Which argument was used to invoke this program? if(!isset($argv[1])) $target="none"; else $target = $argv[1]; // Read the mail $rmail = new Receive_Mail(); if( $rmail->receive("php://stdin") ) { // Mail read switch( $target ) { case "error": include($INCLUDE_ERROR); break; case "test": echo "From: ".$rmail->get_from()."\n"; echo "Subject: ".$rmail->get_subject()."\n"; echo "Date: ".$rmail->get_date()."\n"; echo "Spamscore: ".$rmail->get_spamscore()."\n"; echo "Boundary: ".$rmail->boundary."\n\n"; $message=$rmail->get_message(); for($i=0; $i