View Issue Details

IDProjectCategoryView StatusLast Update
0008436phpList 3 applicationBounce Managementpublic22-06-10 12:07
Reporterosoell 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version2.10.3 
Target VersionFixed in Version 
Summary0008436: VERP processing in processbounces.php
DescriptionI've added a clause to get the bounced user from VERP rather than the X-[ListMember,User]. This will be necessary for fast sending when messages are not personalized, and therefore have no such headers. Patch below- it's small enough that I didn't make a file.
Additional Information--- /home/olivers/phplist/phplist-2.10.3/public_html/lists/admin/processbounces.php 2006-10-03 11:11:07.000000000 -0700
+++ processbounces.php 2006-11-03 15:32:10.000000000 -0800
@@ -114,6 +114,17 @@ function processBounce ($link,$num,$head
       $user = trim($match[1]);
   }
 
+ # added to get user from VERP only
+ # must have message_envelope set as that his how VERP works
+ if (!$user && $GLOBALS["message_envelope"]) {
+ $envelope = $GLOBALS["message_envelope"];
+ $username = substr($envelope, 0, strpos($envelope,'@'));
+ $domain = strstr($envelope, '@');
+ preg_match('/'.$username.'\+(.*)'.$domain.'/',$body,$match);
+ if (is_array($match) && isset($match[1]))
+ $user = str_replace('=','@',trim($match[1]));
+ }
+
   # some versions used the email to identify the users, some the userid and others the uniqid
   # use backward compatible way to find user
   if (preg_match ("/.*@.*/i",$user,$match)) {
@@ -545,4 +556,4 @@ if ($unsubscribed_users) {
 # http://bugs.php.net/bug.php?id=7207
 
 
-?>
\ No newline at end of file
+?>
TagsNo tags attached.

Relationships

related to 0002705 closed PHPList v2.11 release 
related to 0015264 new The phplist_bounce address shouldn't accept attachments 

Activities

h2b2

22-06-10 12:06

manager   ~0051037

On a similar note tipichris developed this patch to allow VERP bounce processing:

====== Start quote ======
I've created a patch to provide VERP bounce processing. This currently works only if phpmailer is being used.

An additional parameter has been added to PHPlistMailer which should be the unique id of the user being mailed. Two additional config parameters must be set:

Code: Select all
    # Do we use VERP
    define ("USE_VERP",1);

    # This should match the recipient delimiter / address extension delimiter configured
    # in your mail server. For Postfix, this is the value of recipient_delimiter and defaults
    # to +. Other systems may vary
    define ("VERP_DELIMITER", '+');



The behaviour is as follows: given a value of $message_envelope of phplist-bounce@example.com, a user unique ID of abcdef1234567890 and a message id of 253 the return path will be set to

phplist-bounce+abcdef1234567890===253@example.com

Bounces sent to this address can then easily be identified as relating to a particular user and message.

The system requires that the mail server to which bounces are directed honours the use of address extensions and places messages to phplist-bounce+abcdef1234567890===253 in the phplist-bounce mailbox

I was going to attach this, but it won't let me. So here it is:

    --- lists/admin/processbounces.php.orig Wed Jun 3 20:00:35 2009
    +++ lists/admin/processbounces.php Wed Jun 3 20:50:55 2009
    @@ -94,9 +94,29 @@

       $body= imap_body ($link,$num);
       $msgid = 0;$user = 0;
    +
    + if(USE_VERP) {
    + // assume the original return path is in the To: header of the bounce
    + $to = $headerinfo->to;
    + foreach ($to as $rcpt) {
    + $bouncemb = $rcpt->mailbox;
    + list($mebox, $mehost) = explode("@", $GLOBALS["message_envelope"], 2);
    + // does this look like one of our VERP addresses?
    + if (preg_match("/" . $mebox . "/i", $bouncemb)) {
    + list($guff, $verpstr) = explode(VERP_DELIMITER, $bouncemb);
    + if ($verpstr) {
    + list($user, $msgid) = explode('===', $verpstr);
    + break;
    + }
    + }
    + }
    + }
    +
    + if (!$msgid) {
       preg_match ("/X-MessageId: (.*)/i",$body,$match);
       if (is_array($match) && isset($match[1]))
         $msgid= trim($match[1]);
    + }
       if (!$msgid) {
         # older versions use X-Message
         preg_match ("/X-Message: (.*)/i",$body,$match);
    @@ -104,9 +124,11 @@
           $msgid= trim($match[1]);
       }

    + if (!$user) {
       preg_match ("/X-ListMember: (.*)/i",$body,$match);
       if (is_array($match) && isset($match[1]))
         $user = trim($match[1]);
    + }
       if (!$user) {
         # older version use X-User
         preg_match ("/X-User: (.*)/i",$body,$match);
    --- lists/admin/class.phplistmailer.php.orig Tue Jun 2 21:36:20 2009
    +++ lists/admin/class.phplistmailer.php Wed Jun 3 20:26:23 2009
    @@ -22,7 +22,7 @@
                       'swf' => 'application/x-shockwave-flash'
                       );

    - function PHPlistMailer($messageid,$email) {
    + function PHPlistMailer($messageid,$email,$uid=null) {
         # parent::PHPMailer();
           parent::SetLanguage('en', dirname(__FILE__) . '/phpmailer/language/');
           $this->addCustomHeader("X-Mailer: phplist v".VERSION);
    @@ -51,8 +51,15 @@
           //$ip = gethostbyname($this->Host);

           if ($GLOBALS["message_envelope"]) {
    + if ($uid && USE_VERP) {
    + list($mebox, $mehost) = explode("@", $GLOBALS["message_envelope"], 2);
    + $verprp = $mebox . VERP_DELIMITER . $uid . "===" . $messageid . '@' . $mehost;
    + $this->Sender = $verprp;
    + $this->addCustomHeader("Errors-To: ". $verprp);
    + } else {
             $this->Sender = $GLOBALS["message_envelope"];
             $this->addCustomHeader("Errors-To: ".$GLOBALS["message_envelope"]);
    + }
           }
         }

    --- lists/admin/sendemaillib.php.orig Sun May 31 21:58:10 2009
    +++ lists/admin/sendemaillib.php Tue Jun 2 21:54:14 2009
    @@ -599,7 +599,7 @@
                 "List-Owner: <mailto:".getConfig("admin_address").">"
         ));
       } else {
    - $mail = new PHPlistMailer($messageid,$destinationemail);
    + $mail = new PHPlistMailer($messageid,$destinationemail,$userdata['uniqid']);
         if ($forwardedby) {
           $mail->add_timestamp();
         }

====== End Quote ======
source: http://forums.phplist.com/viewtopic.php?p=62722#p62722