1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Fix for bounce-handler failure.

This commit is contained in:
Cameron 2015-05-13 11:41:32 -07:00
parent 523d591bb3
commit 2f78304ab2
2 changed files with 41 additions and 13 deletions

View File

@ -212,7 +212,7 @@ $EMAIL_TEMPLATE['notify']['header'] = "<!DOCTYPE html PUBLIC \"-//W3C//
h2 a { text-decoration: none; margin-bottom:5px }
h4 { margin-bottom: 3px }
a { color: #428BCA }
.datestamp { float: right; padding-top:8px }
.datestamp { float: right; padding-top:10px }
.author { font-style: italic ; color: #cccccc}
.summary { padding:5px 0; }
.btn {
@ -240,7 +240,7 @@ $EMAIL_TEMPLATE['notify']['header'] = "<!DOCTYPE html PUBLIC \"-//W3C//
}
td { padding:5px; vertical-align: top }
td.media { width: 200px }
td.body { width:80% }
table { width: 100%; margin-top:8px; border-top: 1px solid #cccccc; border-bottom: 1px solid #cccccc;padding:10px }
.unsubscribe { font-size:11px; color:#aaaaaa; margin-top:20px; padding:20px 0; border-top:solid 1px #e5e5e5; }
</style>
@ -249,7 +249,7 @@ $EMAIL_TEMPLATE['notify']['header'] = "<!DOCTYPE html PUBLIC \"-//W3C//
<body>
<div id='body'>
";
$EMAIL_TEMPLATE['notify']['body'] = "<h2>{SITENAME=link} <small class='text-muted datestamp'>{DATE_LONG}</small></h2><table><tr><td class='media'>{MEDIA1}</td><td>{BODY}</td></tr></table>";
$EMAIL_TEMPLATE['notify']['body'] = "<h2>{SITENAME=link} <small class='text-muted datestamp'>{DATE_LONG}</small></h2><table><tr><td class='media'>{MEDIA1}</td><td class='body'>{BODY}</td></tr></table>";
$EMAIL_TEMPLATE['notify']['footer'] = "<br /><br />

View File

@ -116,7 +116,19 @@ class e107Bounce
if(!empty($message))
{
sendemail($pref['siteadminemail'], SITENAME." :: Bounce-Handler.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
$eml = array(
'subject' => "Bounce-Handler : ",
'sender_email' => $pref['siteadminemail'],
'sender_name' => $pref['siteadmin'],
// 'replyto' => $email,
'html' => true,
'template' => 'default',
'body' => $message
);
e107::getEmail()->sendEmail($pref['siteadminemail'], SITENAME." :: Bounce-Handler.", $eml);
// e107::getEmail()->sendEmail($pref['siteadminemail'], SITENAME." :: Bounce-Handler.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
}
return;
@ -205,25 +217,41 @@ class e107Bounce
*/
function mailRead($iKlimit = 4096)
{
$sErrorSTDINFail = "Error - failed to read mail from STDIN!";
$fp = fopen("php://stdin", "r");
if (!$fp)
{
mail("adminaddress@something.com","Bounce-Processing - Bounce-Processing",$sErrorSTDINFail,$headers);
$pref = e107::getPref();
$eml = array(
'subject' => "Bounce-Handler-Error :",
'sender_email' => $pref['siteadminemail'],
'sender_name' => $pref['siteadmin'],
// 'replyto' => $email,
'html' => true,
'template' => 'default',
'body' => "Error - failed to read mail from STDIN! : ".__FILE__." (".__LINE__.")"
);
e107::getEmail()->sendEmail($pref['siteadminemail'], SITENAME." :: Bounce-Handler.", $eml);
exit();
}
// Create empty string for storing message
$sEmail = "";
$i_limit = 0;
if ($iKlimit == -1) {
while (!feof($fp)) {
if ($iKlimit == -1)
{
while (!feof($fp))
{
$sEmail .= fread($fp, 1024);
}
} else {
while (!feof($fp) && $i_limit < $iKlimit) {
}
else
{
while (!feof($fp) && $i_limit < $iKlimit)
{
$sEmail .= fread($fp, 1024);
$i_limit++;
}
@ -439,7 +467,7 @@ class BounceHandler{
// this is the most commonly used public method
// quick and dirty
// useage: $multiArray = Bouncehandler::get_the_facts($strEmail);
function get_the_facts($eml){
static function get_the_facts($eml){
// fluff up the email
$bounce = BounceHandler::init_bouncehandler($eml);
list($head, $body) = preg_split("/\r\n\r\n/", $bounce, 2);
@ -659,7 +687,7 @@ class BounceHandler{
&& $head_hash['Content-type']['boundary']!=='';
}
function parse_head($headers){
static function parse_head($headers){
if(!is_array($headers)) $headers = explode("\r\n", $headers);
$hash = BounceHandler::standard_parser($headers);
// get a little more complex