View Issue Details

IDProjectCategoryView StatusLast Update
0015510phplist applicationBounce Managementpublic20-06-13 17:17
Reporterh2b2 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version2.10.12 
Target Version2.11.11Fixed in Version2.11.11 
Summary0015510: Improve bounce processing with beter detection of user email addresses in bounced messages
Descriptionlpaopia suggests current standard bounce processing could be improved by using a better way to recognize a user's email address in bounced messages.
Additional InformationThese are lpaopia suggested code changes:

===== Start quote ====
There is a lot of bounces that is not processed because is not possible recovery relevant data in order to identify the users' email address. I humbly propose this lines that can do it. This code can be better. I tested it, it works.

processbounces.php
insert below line 116:

       if (!$user) { //finally, recover every email address for compare them with the table "user" and return its uniquid
          $filling = "";
          $at_warn = -1;
          for ($n = 0; $n < strlen($body); $n++) { //go over every char. for extract the emails in field "data"
             $character = substr($body, $n, 1);
             if ($at_warn == -1 && eregi("[0-9A-Za-z]", $character)) { //first character of the address
                $filling .= $character;
                $at_warn = 0;
             } elseif (ereg("[0-9A-Za-z._-]", $character)) { //rest of characters of the email, except "@"
                $filling .= $character;
             } elseif ($character == '@') { //'at'
                $filling .= $character;
                $at_warn = 1;
             } else {
                if ($at_warn == 1) {
                   for ($m = 1; $m <= strlen($filling); $m++) { //cutting out ".-_" at the end of email
                      if (ereg("[.-_]", substr($filling, $m * -1, 1)))
                         $filling = substr($filling, 0, strlen($filling) - $m);
                      else break;
                   }
                   $at_warn = -1;
                   if ($filling == $GLOBALS['message_envelope'] ||
                       eregi("[@.]".getConfig("domain")."$", $filling)) { //exclude the address where arrive the bounces and every address in domain
                      $filling = "";
                      break;
                   }
                   $userid_req = Sql_Fetch_Row_Query("select id from {$tables["user"]} where email = \"$filling\"");
                   if (VERBOSE)
                      output("UID".$userid_req[0]." MSGID".$msgid);
                   if (isset($userid_req[0])) {
                      if ($userid_req[0] >0) {
                         $user = $filling;
                         $filling = "";
                         break;
                      }
                   }
                }
                $filling = "";
             }
          }
       }

================

Also, I saw it's necessary to patch other code, for remove "buggy" behavior:

processbounces.php

      if ($msgid == "systemmessage" && $userid) {

replace for:

      if ($msgid === "systemmessage" && $userid) {
    ---------------^


This, above, does bounces with undentified number of message not be like "systemmessage", because when $msgid has the value 0, is like ($msgid == "systemmessage").

And, bounce.php

      if (preg_match("#([\d]+) bouncecount increased#",$bounce["comment"],$regs)) {

replace for:

    ---------------------------v
      if (preg_match("#([\d]+) [bouncecount increased|marked
    unconfirmed]#",$bounce["comment"],$regs)) {
    -----------^



This other recovery every user's id of comment line in bounce record

============

The "buggy" bounce.php again. I sugest to add these lines below the number 17:

    $useremail = isset($_GET["useremail"]) ? $_GET["useremail"] : '';
    $amount = isset($_GET["amount"]) ? ( ereg("-?[0-9]+", $_GET["amount"]) ? $_GET["amount"] : '0' ) : '0';
    $unconfirm = isset($_GET["unconfirm"]) ? $_GET["unconfirm"] : '0';
    $maketext = isset($_GET["maketext"]) ? $_GET["maketext"] : '0';
    $deleteuser = isset($_GET["deleteuser"]) ? $_GET["deleteuser"] : '0';
    $deletebounce = isset($_GET["deletebounce"]) ? $_GET["deletebounce"] : '0';


And in the new 124:

      print '<tr><td>'.$GLOBALS['I18N']->get('IncreaseB').'</td><td><input type=text name=amount value="'.$amount.'" size=5>'.$GLOBALS['I18N']->get('IncreaseBNote').'</td></tr>';

===== End Quote =====
Related forum thread: http://forums.phplist.com/viewtopic.php?f=18&t=31690
TagsNo tags attached.

Relationships

related to 0014372 resolvedmichiel Bounce processing gives up with quoted printable encoding