mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Correct mail-id detection in bounce handling routine.
This commit is contained in:
@@ -449,10 +449,11 @@ class mailout_main_ui extends e_admin_ui
|
||||
$eml = array(
|
||||
'subject' => LAN_MAILOUT_113." ".$add,
|
||||
'body' => str_replace("[br]", "\n", LAN_MAILOUT_114),
|
||||
'template' => vartrue($_POST['testtemplate'],null)
|
||||
'template' => vartrue($_POST['testtemplate'],null),
|
||||
'shortcodes' => array('USERID'=>555, 'USERNAME'=>'John Smith', 'LOGINNAME'=>'TestName', 'PASSWORD'=>'xxxxxxx', 'ACTIVATION_LINK'=>SITEURL."signup.php#activate")
|
||||
);
|
||||
|
||||
if (!e107::getEmail()->sendEmail($sendto,LAN_MAILOUT_189,$eml))
|
||||
if (!e107::getEmail()->sendEmail($sendto, LAN_MAILOUT_189, $eml))
|
||||
{
|
||||
$mes->addError(($pref['mailer'] == 'smtp') ? LAN_MAILOUT_67 : LAN_MAILOUT_106);
|
||||
}
|
||||
|
@@ -14,7 +14,6 @@ if (!defined('e107_INIT'))
|
||||
require_once($class2);
|
||||
}
|
||||
|
||||
echo "test";
|
||||
|
||||
$bnc = new e107Bounce;
|
||||
$process = (varset($_GET['eml']) && $_E107['debug']) ? $_GET['eml'].".eml" : FALSE;
|
||||
@@ -43,6 +42,8 @@ class e107Bounce
|
||||
|
||||
$multiArray = Bouncehandler::get_the_facts($strEmail);
|
||||
$head = BounceHandler::parse_head($strEmail);
|
||||
$message = null;
|
||||
|
||||
|
||||
$e107_userid = (isset($head['X-e107-id'])) ? $head['X-e107-id'] : $this->getHeader($strEmail,'X-e107-id');
|
||||
|
||||
@@ -50,12 +51,16 @@ class e107Bounce
|
||||
{
|
||||
require_once(e_HANDLER."mail.php");
|
||||
$message = "Your Bounce Handler is working. The data of the email you sent is displayed below.<br />";
|
||||
|
||||
if($e107_userid)
|
||||
{
|
||||
$message .= "A user-id was detected in the email you sent: <b>".$e107_userid."</b><br />";
|
||||
}
|
||||
$message .= "<br />";
|
||||
$message .= "<pre>".print_r($multiArray,TRUE). "</pre>";
|
||||
|
||||
$message .= "<br /><h4>Head</h4>";
|
||||
$message .= print_a($head,true);
|
||||
$message .= "<h4>Emails Found</h4><pre>".print_r($multiArray,TRUE). "</pre>";
|
||||
|
||||
$message .= "<pre>".$strEmail. "</pre>";
|
||||
|
||||
if(varset($_GET['eml']))
|
||||
@@ -63,16 +68,27 @@ class e107Bounce
|
||||
// echo $message;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!empty($e107_userid))
|
||||
{
|
||||
if($errors = $this->setUser_Bounced($e107_userid))
|
||||
{
|
||||
$mesage .= print_a($errors);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($message))
|
||||
{
|
||||
sendemail($pref['siteadminemail'], SITENAME." :: Bounce-Handler.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
|
||||
}
|
||||
}
|
||||
|
||||
if($e107_userid && ($this->setUser_Bounced($e107_userid)==true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* echo "<pre>";
|
||||
print_r($multiArray);
|
||||
echo "</pre>";
|
||||
@@ -126,7 +142,7 @@ class e107Bounce
|
||||
{
|
||||
if(strpos($val,$id.":")!== false)
|
||||
{
|
||||
return intval(str_replace($id.":","",$val));
|
||||
return str_replace($id.":","",$val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,12 +156,12 @@ class e107Bounce
|
||||
require_once(e_HANDLER.'mail_manager_class.php');
|
||||
|
||||
$mailManager = new e107MailManager();
|
||||
if ($mailManager->markBounce($bounceString, $email))
|
||||
{ // Success
|
||||
if ($errors = $mailManager->markBounce($bounceString, $email))
|
||||
{
|
||||
return $errors; // Failure
|
||||
}
|
||||
// Failure
|
||||
// $query = (is_numeric($id_or_email)) ? "user_ban = 3 WHERE user_id = ".intval($id_or_email)." LIMIT 1" : "user_ban = 3 WHERE user_email = '".$id_or_email."' ";
|
||||
// return e107::getDb()->db_Update('user',$query);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1243,6 +1243,8 @@ class e107MailManager
|
||||
public function markBounce($bounceString, $emailAddress = '')
|
||||
{
|
||||
|
||||
$bounceString = trim($bounceString);
|
||||
|
||||
$bounceInfo = array('mail_bounce_string' => $bounceString, 'mail_recipient_email' => $emailAddress); // Ready for event data
|
||||
$errors = array(); // Log all errors, at least until proven
|
||||
$vals = explode('/', $bounceString); // Should get one or four fields
|
||||
@@ -1261,10 +1263,6 @@ class e107MailManager
|
||||
|
||||
if (count($vals) == 4) // Admin->Mailout format.
|
||||
{
|
||||
if (md5($vals[0].'/'.$vals[1].'/'.$vals[2].'/') != $vals[3]) // 'Extended' ID has md5 validation
|
||||
{
|
||||
$errors[] = 'Bad md5';
|
||||
}
|
||||
|
||||
if (!is_numeric($vals[1])) // Email body record number
|
||||
{
|
||||
@@ -1276,10 +1274,22 @@ class e107MailManager
|
||||
$errors[] = 'Bad recipient record: '.$vals[2];
|
||||
}
|
||||
|
||||
$vals[0] = intval($vals[0]);
|
||||
$vals[1] = intval($vals[1]);
|
||||
$vals[2] = intval($vals[2]);
|
||||
$vals[3] = trim($vals[3]);
|
||||
|
||||
if (count($errors) == 0)
|
||||
|
||||
$hash = ($vals[0].'/'.$vals[1].'/'.$vals[2].'/');
|
||||
|
||||
if (md5($hash) != $vals[3]) // 'Extended' ID has md5 validation
|
||||
{
|
||||
$errors[] = 'Bad md5';
|
||||
$errors[] = print_r($vals,true);
|
||||
$errors[] = 'hash:'.md5($hash);
|
||||
}
|
||||
|
||||
if (empty($errors))
|
||||
{
|
||||
$this->checkDB(1); // Look up in mailer DB if no errors so far
|
||||
|
||||
@@ -1374,21 +1384,23 @@ class e107MailManager
|
||||
}
|
||||
}
|
||||
|
||||
if (count($errors))
|
||||
if (!empty($errors))
|
||||
{
|
||||
$logString = $bounceString.' ('.$emailAddress.')[!br!]'.implode('[!br!]',$errors);
|
||||
$logString = $bounceString.' ('.$emailAddress.')[!br!]'.implode('[!br!]',$errors).implode('[!br!]',$bounceInfo);
|
||||
// e107::getAdminLog()->e_log_event(10,-1,'BOUNCE','Bounce receive error',$logString, FALSE,LOG_TO_ROLLING);
|
||||
e107::getAdminLog()->add('Bounce receive error',$logString, E_LOG_WARNING, 'BOUNCE', LOG_TO_ROLLING);
|
||||
return false;
|
||||
return $errors;
|
||||
}
|
||||
else
|
||||
{
|
||||
// e107::getAdminLog()->e_log_event(10,-1,'BOUNCE','Bounce received/logged',$bounceInfo, FALSE,LOG_TO_ROLLING);
|
||||
e107::getAdminLog()->add('Bounce received/logged',$bounceInfo, E_LOG_INFORMATIVE, 'BOUNCE',LOG_TO_ROLLING);
|
||||
}
|
||||
|
||||
// e107::getAdminLog()->e_log_event(10,-1,'BOUNCE','Bounce received/logged',$bounceInfo, FALSE,LOG_TO_ROLLING);
|
||||
|
||||
e107::getAdminLog()->add('Bounce received/logged',$bounceInfo, E_LOG_INFORMATIVE, 'BOUNCE',LOG_TO_ROLLING);
|
||||
|
||||
e107::getEvent()->trigger('mailbounce', $bounceInfo);
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user