Abstract save email function; call the function on routing error
This commit is contained in:
parent
0c9d808302
commit
281022be8f
21
redirect.php
21
redirect.php
@ -87,20 +87,14 @@ if($project) {
|
||||
}
|
||||
|
||||
if($debugMode) {
|
||||
// debug code
|
||||
//debug code.
|
||||
$email .= "\n\nDelivered To - $deliveredTo\n";
|
||||
$email .= "Project - $project\n";
|
||||
$email .= "From - $from\n";
|
||||
$email .= "Subject - $subject\n";
|
||||
$email .= "Params:\n";
|
||||
$email .= print_r($params, TRUE);
|
||||
$debugFileName = '/tmp/EmailProcessing' . time();
|
||||
echo "$debugFileName";
|
||||
$debugFile = fopen($debugFileName, 'w');
|
||||
fwrite($debugFile, $email);
|
||||
fclose($debugFile);
|
||||
// also print to stdout, in case we're running manually
|
||||
echo $email;
|
||||
saveEmail($email);
|
||||
}
|
||||
|
||||
if(!$dryRun) {
|
||||
@ -146,6 +140,7 @@ function SendToMailHandler($input, $params) {
|
||||
$message = $log . "\n\n";
|
||||
$message .= $input;
|
||||
mail($to, $subject, $message);
|
||||
saveEmail($input);
|
||||
}
|
||||
|
||||
echo "command returned $return_value\n";
|
||||
@ -186,4 +181,14 @@ function ParseSenderDomain($email) {
|
||||
return $project;
|
||||
}
|
||||
|
||||
function saveEmail($email) {
|
||||
$debugFileName = '/tmp/EmailProcessing' . time();
|
||||
echo "$debugFileName";
|
||||
$debugFile = fopen($debugFileName, 'w');
|
||||
fwrite($debugFile, $email);
|
||||
fclose($debugFile);
|
||||
// also print to stdout, in case we're running manually
|
||||
echo $email;
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user