1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-16 03:24:20 +02:00

Mailout bounce handling fixes.

This commit is contained in:
Cameron
2014-10-22 17:58:20 -07:00
parent be970117ff
commit a3bb284031
9 changed files with 243 additions and 113 deletions

View File

@@ -4,7 +4,7 @@
// WARNING, any echoed output from this script will be returned to the sender as a bounce message.
$_E107['debug'] = FALSE;
$_E107['debug'] = true;
if (!defined('e107_INIT'))
@@ -14,6 +14,7 @@ if (!defined('e107_INIT'))
require_once($class2);
}
echo "test";
$bnc = new e107Bounce;
$process = (varset($_GET['eml']) && $_E107['debug']) ? $_GET['eml'].".eml" : FALSE;
@@ -33,13 +34,17 @@ class e107Bounce
if(!$strEmail)
{
if($_E107['debug'] === true)
{
echo "Couldn't get email data";
}
return;
}
$multiArray = Bouncehandler::get_the_facts($strEmail);
$head = BounceHandler::parse_head($strEmail);
$e107_userid = (isset($head['X-e107-id'])) ? intval($head['X-e107-id']) : $this->getHeader($strEmail,'X-e107-id');
$e107_userid = (isset($head['X-e107-id'])) ? $head['X-e107-id'] : $this->getHeader($strEmail,'X-e107-id');
if($_E107['debug'])
{
@@ -51,11 +56,19 @@ class e107Bounce
}
$message .= "<br />";
$message .= "<pre>".print_r($multiArray,TRUE). "</pre>";
$message .= "<pre>".$strEmail. "</pre>";
sendemail($pref['siteadminemail'], SITENAME." :: Bounce-Handler.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
$message .= "<pre>".$strEmail. "</pre>";
if(varset($_GET['eml']))
{
// echo $message;
}
else
{
sendemail($pref['siteadminemail'], SITENAME." :: Bounce-Handler.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
}
}
if($e107_userid && ($this->setUser_Bounced($e107_userid)==TRUE))
if($e107_userid && ($this->setUser_Bounced($e107_userid)==true))
{
return;
}
@@ -76,7 +89,7 @@ class e107Bounce
{
case 'failed':
e107::getEvent()->trigger('email-bounce-failed', $the);
$this->setUser_Bounced($the['user_email']);
$this->setUser_Bounced(null, $the['user_email']);
break;
case 'transient':
@@ -85,7 +98,7 @@ class e107Bounce
e107::getEvent()->trigger('email-bounce-transient', $the);
if($num_attempts > 10)
{
$this->setUser_Bounced($the['user_email'], $the['user_id']);
$this->setUser_Bounced($the['user_id'], $the['user_email']);
}
else
{
@@ -111,7 +124,7 @@ class e107Bounce
$tmp = explode("\n",$message);
foreach($tmp as $val)
{
if(strpos($val,$id.":")!==FALSE)
if(strpos($val,$id.":")!== false)
{
return intval(str_replace($id.":","",$val));
}
@@ -120,12 +133,13 @@ class e107Bounce
function setUser_Bounced($email, $bounceString = '')
function setUser_Bounced($bounceString = '', $email='' )
{
if(!$email && !$bounceString){ return; }
// echo "Email bounced ID: ".$id_or_email;
require_once(e_HANDLER.'mail_manager_class.php');
$mailHandler = new e107MailManager();
$mailManager = new e107MailManager();
if ($mailManager->markBounce($bounceString, $email))
{ // Success
}