Problems with bounce handling setup and processing

I have set up a new system (actually migrated from an older version) using 3.3.1, and I have configured processbounces to run as a cron job, using:

 phplistusr /usr/bin/php /var/webs/campaign/www/admin/index.php -pprocessbounces -c/var/webs/campaign/www/config/config.php

I sent a test campaign to an experimental subscriber list with 6 members, one of which is fake (janis.joplin@noa.gr), so as to test bounces. Campaign sender is listsender2@noa.gr

I have configured:

$bounce_mailbox_user = 'noabounce2';

thinking that I am going to receive bounces (non-delivery reports) there, but I don’t seem to get such a report there.

When I send the campaign, I receive the following report from the processqueue job:

Exhibit A:

phpList version 3.3.1 (c) 2000-2017 phpList Ltd, http://www.phplist.com
PHPlist - Maximum time for queue processing: 99999 [0.0008910000] (98)
PHPlist - Recently sent : 0
PHPlist - Started [0.0011130000] (101)
PHPlist - Sending in batches of 200 emails [0.0001830000] (102)
PHPlist -  select id from phplist_message where status not in ("draft", "sent", "prepared", "suspended") and embargo  [0.0007350000] (103)
PHPlist - Processing has started, [0.0009290000] (106)
PHPlist - One campaign to process. [0.0003680000] (108)
PHPlist - sending of this campaign will stop, if it is still going in  5 minutes 59 seconds [0.0297610000] (123)
PHPlist - Processing message 308 [0.2745230000] (140)
PHPlist - Looking for subscribers [0.1000800000] (145)
PHPlist - User select query select distinct u.id from phplist_listuser as listuser
        inner join phplist_user_user as u ON u.id = listuser.userid
        inner join phplist_listmessage as listmessage ON listuser.listid = listmessage.listid
        left join phplist_usermessage as um ON (um.messageid = 308 and um.userid = listuser.userid)
        where 
        listmessage.messageid = 308
        and listmessage.listid = listuser.listid
        and u.id = listuser.userid
        and um.userid IS NULL
        and u.confirmed and !u.blacklisted and !u.disabled
          [0.0004240000] (148)
PHPlist - Found them: 6 to process [0.0556750000] (152)
...
<Removed: 5 successful mails are sent>
...
PHPlist - Failed sending to janis.joplin@noa.gr [0.0007980000] (364)
PHPlist - sent 5 ETA Sun 10 Sep 17:24 sending 2329 msg/hrPHPlist - Processed 6 out of 6 subscribers [1.0021790000] (372)
PHPlist - Script stage: 5 [0.0006470000] (374)
PHPlist - 5 messages sent in 7.73 seconds (2328 msgs/hr) [0.0008540000] (377)
PHPlist - 1 failed (will retry later) [0.0005360000] (379)
PHPlist - 1 Campaign
PHPlist - 0 num_users_for_message
PHPlist - 6 batch_count
PHPlist - 200 batch_total
PHPlist - 1 sendemail returned false total
PHPlist - 0 send blocked by domain throttle
PHPlist - 0 add attachment error
PHPlist - 1 sendemail returned false
PHPlist - 0 sentastest
PHPlist - 0 invalid
PHPlist - 1 failed_sent
PHPlist - 5 Sent
PHPlist - 200 num_per_batch
PHPlist - 1 Status
PHPlist - 5 sent_users_for_message 308
PHPlist - 6 total_users_for_message 308
PHPlist - 0 max_users_for_message 308
PHPlist - 6 processed_users_for_message 308
PHPlist - 1 failed_sent_for_message 308
PHPlist - Finished this run [0.0117710000] (436)

In the noabounce2 mailbox I get the following mail message (when the processqueue job has finished):

Exhibit B:

# cat /home/vmail/noabounce2/Maildir/new/1505053449.M749823P3606.vmail2.noa.gr\,S\=6127\,W\=6234 
Return-Path: <listsender2@noa.gr>
Delivered-To: noabounce2@noa.gr
Received: from vmail2.noa.gr
        by vmail2.noa.gr with LMTP id oOmeLAlLtVkWDgAAcV+qjQ
        for <noabounce2@noa.gr>; Sun, 10 Sep 2017 17:24:09 +0300
Received: from campaign.noa.gr (vweb2.noa.gr [IPv6:2001:648:2011:15::164])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by vmail2.noa.gr (IC-XC-NI-KA) with ESMTPSA id 9F66680004F2F
        for <noabounce2@noa.gr>; Sun, 10 Sep 2017 17:24:09 +0300 (EEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=noa.gr; s=default;
        t=1505053449; bh=IGd+/Za7UcmVkT9D4PrlXp7MIYcbpYUQ2tw8h8yKw6o=;
        h=Date:To:From:Subject:List-Unsubscribe;
        b=JkouBUiGW2DYOqtyK5bt5kZP73BnnOdcqhVpXNS0gMDCbFP5Yd60iY6EY3CkOwWSk
         FUTlzTcENGLYI1+asqvZb0nwhCuGxhLs3taHWXgGDEzUGV/UEH4wD487J55IgeL9fD
         copSYr0TzU3oqzib86kBuVLrR3Qz/1IMZL8BvHqc=
Date: Sun, 10 Sep 2017 17:24:09 +0300
To: noabounce2@noa.gr
From: PHPList Master <listsender2@noa.gr>
Subject: PHPlist Message queue processing report
Message-ID: <0e9d5fb145021e95db489520558576e3@campaign.noa.gr>
X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
X-phpList-version: 3.3.1
X-MessageID: systemmessage
X-ListMember: noabounce2@noa.gr
Precedence: bulk
Bounces-To: listsender2@noa.gr
List-Unsubscribe: <http://campaign.noa.gr/?p=unsubscribe&email=noabounce2@noa.gr&jo=1>
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="b1_0e9d5fb145021e95db489520558576e3"

This is a multi-part message in MIME format.

--b1_0e9d5fb145021e95db489520558576e3
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

The following events occured while processing the message queue:

[Sun 10 Sep 2017 17:24] [CL] Started
[Sun 10 Sep 2017 17:24] [CL] Sending in batches of 200 emails
[Sun 10 Sep 2017 17:24] [CL] select id from phplist_message where status
not in ("draft", "sent", "prepared", "suspended") and embargo=20


--b1_0e9d5fb145021e95db489520558576e3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div style=3D"margin:0; text-align:center; width:100%; background:#EEE;min-=
width:240px;height:100%;"><br />=0A    <div style=3D"width:96%;margin:0 aut=
o; border-top:6px solid #369;border-bottom: 6px solid #369;background:#DEF;=
" >=0A        <h3 style=3D"margin-top:5px;background-color:#69C; font-weigh=
t:normal; color:#FFF; text-align:center; margin-bottom:5px; padding:10px; l=
ine-height:1.2; font-size:21px; text-transform:capitalize;">PHPlist Message=
 queue processing report</h3>=0A        <div style=3D"text-align:justify;ba=
ckground:#FFF;padding:20px; border-top:2px solid #369;min-height:200px;font=
-size:13px; border-bottom:2px solid #369;">The following events occured whi=
le processing the message queue:=0A=0A[Sun 10 Sep 2017 17:24] [CL] Started=
=0A[Sun 10 Sep 2017 17:24] [CL] Sending in batches of 200 emails=0A[Sun 10 =
Sep 2017 17:24] [CL]  select id from phplist_message where status not in ("=
draft", "sent", "prepared", "suspended") and embargo <=3D now() order by en=
tered  limit 5 =0A[Sun 10 Sep 2017 17:24] [CL] Processing has started,=0A[S=
un 10 Sep 2017 17:24] [CL] One campaign to process.=0A[Sun 10 Sep 2017 17:2=
4] [CL] sending of this campaign will stop, if it is still going in  5 minu=
tes 59 seconds=0A[Sun 10 Sep 2017 17:24] [CL] Processing message 308=0A[Sun=
 10 Sep 2017 17:24] [CL] Looking for subscribers=0A[Sun 10 Sep 2017 17:24] =
[CL] User select query select distinct u.id from phplist_listuser as listus=
er=0A        inner join phplist_user_user as u ON u.id =3D listuser.userid=
=0A        inner join phplist_listmessage as listmessage ON listuser.listid=
 =3D listmessage.listid=0A        left join phplist_usermessage as um ON (u=
m.messageid =3D 308 and um.userid =3D listuser.userid)=0A        where =0A =
       listmessage.messageid =3D 308=0A        and listmessage.listid =3D l=
istuser.listid=0A        and u.id =3D listuser.userid=0A        and um.user=
id IS NULL=0A        and u.confirmed and !u.blacklisted and !u.disabled=0A =
        =0A[Sun 10 Sep 2017 17:24] [CL] Found them: 6 to process=0A[Sun 10 =
Sep 2017 17:24] [CL] Sending 308 to 
...<Removed>... 
Failed sending to janis.joplin@noa.gr=0A[Sun 10 Sep 2017 17:24] [CL] Pr=
ocessed 6 out of 6 subscribers=0A[Sun 10 Sep 2017 17:24] [CL] Script stage:=
 5=0A[Sun 10 Sep 2017 17:24] [CL] 5 messages sent in 7.73 seconds (2328 msg=
s/hr)=0A[Sun 10 Sep 2017 17:24] [CL] 1 failed (will retry later)=0A=0ATo st=
op receiving these reports read: https://resources.phplist.com/system/confi=
g/send_queue_processing_report=0A=0A<div style=3D"clear:both"></div></div>=
=0A        <div style=3D"clear:both;background:#69C;font-weight:normal; pad=
ding:10px;color:#FFF;text-align:center;font-size:11px;margin:5px 0px"><br/>=
<div style=3D"clear: both; font-family: arial, verdana, sans-serif; font-si=
ze: 8px; font-variant: small-caps; font-weight: normal; padding: 2px; paddi=
ng-left:10px;padding-top:20px;">powered by <a href=3D"https://www.phplist.c=
om/poweredby?utm_source=3Ddownload3.3.1&amp;utm_medium=3Dpoweredtxt&amp;utm=
_campaign=3DphpList" target=3D"_blank" title=3D"powered by phpList version =
3.3.1, &copy; phpList ltd">phpList</a></div></div>=0A    </div>=0A<br /></d=
iv>


--b1_0e9d5fb145021e95db489520558576e3--

When I run the processbounces job, I get the following output from the cron job:

Exhibit C:

phpList version 3.3.1 (c) 2000-2017 phpList Ltd, http://www.phplist.com
PHPlist - bounces to fetch from the mailbox
PHPlist - Please do not interrupt this process
PHPlist - UID0 MSGID0
PHPlist - Deleting message 1
PHPlist - Closing mailbox, and purging messages
PHPlist - reprocessing
PHPlist - 6 bounces to reprocess
PHPlist - 6 out of 6 processed
PHPlist - 0 bounces were re-processed and 0 bounces were re-identified
PHPlist - Identifying consecutive bounces
PHPlist - Nothing to do
PHPlist - total of 0 subscribers processed                            

(I once had an error, which I reported at: SQL Error when Processing Bounces)

What I understand from the above:

1/ I don’t get a normal bounce at noabounce2 mailbox. Have I configured something wrong or this is because of 2 (see below)?

2/ The processqueue job states “1 failed (will retry later)”. Why shall it try later? The server, while sending the particular mail logged:

Exhibit D:

Sep 10 17:24:08 vmail2 postfix/submission/smtpd[3600]: connect from vweb2.noa.gr[2001:648:2011:15::164]
Sep 10 17:24:08 vmail2 postfix/submission/smtpd[3600]: Anonymous TLS connection established from vweb2.noa.gr[2001:648:2011:15::164]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Sep 10 17:24:08 vmail2 postfix/submission/smtpd[3600]: NOQUEUE: reject: RCPT from vweb2.noa.gr[2001:648:2011:15::164]: 550 5.1.1 <janis.joplin@noa.gr>: Recipient address rejected: User unknown in virtual mailbox table; from=<listsender2@noa.gr> to=<janis.joplin@noa.gr> proto=ESMTP helo=<campaign.noa.gr>
Sep 10 17:24:08 vmail2 postfix/submission/smtpd[3600]: disconnect from vweb2.noa.gr[2001:648:2011:15::164] ehlo=2 starttls=1 auth=1 mail=1 rcpt=0/1 quit=1 commands=6/7

So, the server has responded that the recipient is non-existent. Why phplist will try later and does not end-up and produce a proper bounce?

3/ Why do I get the “Exhibit B” report at noabounce2 mailbox? I wouldn’t expect to receive such a report there. Specifically, I would only expect to get bounces from campaign mails at that mailbox.

4/ The report received at noabounce2 mailbox is deleted during the processbounces job. I guess this happens because I have configured:

$bounce_mailbox_purge_unprocessed = 1;

Right?

5/ When the campaign is complete, the Campaign stats show “Bounces: 0”. The undelivered mail never gets reported. How can I fix this situation?

Please advise!

Thanks a lot,
Nick

Note: I had forgotten to set:

message_envelope = 'noabounce2@noa.gr';

(as I found from: http://www.inmotionhosting.com/support/edu/phplist/sending-messages/handling-bounces)

However, things did not change after I configured the above setting. The same questions apply.

Looking forward to your assistance!

Thanks,
Nick

Shouldn’t the bounce mailbox user be the user login for the bounce mailbox? (and include the domain?)

$bounce_mailbox_user = ‘noabounce2’;

the bounce mailbox is set in the config files as

$message_envelope = ‘bounce_mailbox@domain.com’;

  1. That should have returned a bounce to your bounce email box.
  2. You must have specified the noabounce2@noa.gr as the email address for sending reports. Look on your settings page in the web UI, and in the config.php file.
  3. Correct
  4. The system is not processing the bounces AND linking the bounced address to the user in the database. Delete and recreate the user and try again (just in case there is a ‘weird’ character in the email address. It could also be due to some missing php modules that would parse the email (mbstring?) any ideas @duncanc ?

Thank you for your reply. Some answers:

It seems that I have set the above correctly, since phplist is sending some mail there and the processbounces job is able to login and process the content (it deletes the messages too).

According to the documentation, there is no need to send from the bounce address; the $message_envelope parameter is the one that sets the bounce address.

However, I tried this too, but no change in the behavior occurred.

Here is the log from the mail server:

Sep 11 20:43:09 vmail2 postfix/submission/smtpd[5926]: connect from vweb2.noa.gr[2001:648:2011:15::164]
Sep 11 20:43:09 vmail2 postfix/submission/smtpd[5926]: Anonymous TLS connection established from vweb2.noa.gr[2001:648:2011:15::164]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Sep 11 20:43:09 vmail2 postfix/submission/smtpd[5926]: NOQUEUE: reject: RCPT from vweb2.noa.gr[2001:648:2011:15::164]: 550 5.1.1 <janis.joplin@noa.gr>: Recipient address rejected: User unknown in virtual mailbox table; from=<noabounce2@noa.gr> to=<janis.joplin@noa.gr> proto=ESMTP helo=<campaign.noa.gr>
Sep 11 20:43:09 vmail2 postfix/submission/smtpd[5926]: disconnect from vweb2.noa.gr[2001:648:2011:15::164] ehlo=2 starttls=1 auth=1 mail=1 rcpt=0/1 quit=1 commands=6/7
Sep 11 20:43:10 vmail2 postfix/submission/smtpd[5926]: connect from vweb2.noa.gr[2001:648:2011:15::164]
Sep 11 20:43:10 vmail2 postfix/submission/smtpd[5926]: Anonymous TLS connection established from vweb2.noa.gr[2001:648:2011:15::164]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Sep 11 20:43:10 vmail2 postfix/submission/smtpd[5926]: E3E4680004F2D: client=vweb2.noa.gr[2001:648:2011:15::164], sasl_method=LOGIN, sasl_username=listsender2
Sep 11 20:43:10 vmail2 postfix/cleanup[5930]: E3E4680004F2D: message-id=<ca87084adc81ddd3393699c7ebe558eb@campaign.noa.gr>
Sep 11 20:43:10 vmail2 opendkim[20675]: E3E4680004F2D: DKIM-Signature field added (s=default, d=noa.gr)
Sep 11 20:43:11 vmail2 postfix/qmgr[4843]: E3E4680004F2D: from=<noabounce2@noa.gr>, size=8248, nrcpt=1 (queue active)
Sep 11 20:43:11 vmail2 postfix/submission/smtpd[5926]: disconnect from vweb2.noa.gr[2001:648:2011:15::164] ehlo=2 starttls=1 auth=1 mail=1 rcpt=1 data=1 quit=1 commands=8
Sep 11 20:43:11 vmail2 postfix/lmtp[5931]: E3E4680004F2D: to=<noabounce2@noa.gr>, relay=vmail2.noa.gr[private/dovecot-lmtp], delay=0.1, delays=0.092/0.002/0.001/0.009, dsn=2.0.0, status=sent (250 2.0.0 <noabounce2@noa.gr> uPpkAS/LtlksFwAAcV+qjQ Saved)
Sep 11 20:43:11 vmail2 postfix/qmgr[4843]: E3E4680004F2D: removed

The processqueue job report:

phpList version 3.3.1 (c) 2000-2017 phpList Ltd, http://www.phplist.com
PHPlist - Maximum time for queue processing: 99999 [0.0063700000] (97)
PHPlist - Recently sent : 0
PHPlist - Started [0.0011870000] (100)
PHPlist - Sending in batches of 200 emails [0.0002040000] (101)
PHPlist -  select id from phplist_message where status not in ("draft", "sent", "prepared", "suspended") and embargo  [0.0007580000] (102)
PHPlist - Processing has started, [0.0009060000] (105)
PHPlist - 3 campaigns to process. [0.0002900000] (107)
PHPlist - sending of this campaign will stop, if it is still going in  -21 hours -43 minutes -2 seconds [0.0039280000] (123)
PHPlist - Processing message 309 [0.0011500000] (128)
PHPlist - Looking for subscribers [0.0005970000] (133)
PHPlist - User select query select distinct u.id from phplist_listuser as listuser
        inner join phplist_user_user as u ON u.id = listuser.userid
        inner join phplist_listmessage as listmessage ON listuser.listid = listmessage.listid
        left join phplist_usermessage as um ON (um.messageid = 309 and um.userid = listuser.userid)
        where 
        listmessage.messageid = 309
        and listmessage.listid = listuser.listid
        and u.id = listuser.userid
        and um.userid IS NULL
        and u.confirmed and !u.blacklisted and !u.disabled
          [0.0003390000] (136)
PHPlist - Found them: 1 to process [0.1138730000] (140)
PHPlist - Campaign sending timed out, is past date to process until [0.0173500000] (144)
PHPlist - Processed 0 out of 1 subscribers [0.0003890000] (146)
PHPlist - Hmmm, No subscribers found to send to [0.0003630000] (148)
PHPlist - It took  21 hours 59 minutes to send this message [0.2927330000] (165)
PHPlist - sending of this campaign will stop, if it is still going in  -21 hours -43 minutes -2 seconds [0.0072820000] (170)
PHPlist - Processing message 310 [0.0007600000] (174)
PHPlist - Looking for subscribers [0.0009530000] (178)
PHPlist - User select query select distinct u.id from phplist_listuser as listuser
        inner join phplist_user_user as u ON u.id = listuser.userid
        inner join phplist_listmessage as listmessage ON listuser.listid = listmessage.listid
        left join phplist_usermessage as um ON (um.messageid = 310 and um.userid = listuser.userid)
        where 
        listmessage.messageid = 310
        and listmessage.listid = listuser.listid
        and u.id = listuser.userid
        and um.userid IS NULL
        and u.confirmed and !u.blacklisted and !u.disabled
          [0.0003840000] (181)
PHPlist - Found them: 1 to process [0.1383970000] (183)
PHPlist - Campaign sending timed out, is past date to process until [0.0062150000] (186)
PHPlist - Processed 0 out of 1 subscribers [0.0001680000] (187)
PHPlist - Hmmm, No subscribers found to send to [0.0001470000] (188)
PHPlist - It took  21 hours 48 minutes 59 seconds to send this message [0.2331600000] (195)
PHPlist - sending of this campaign will stop, if it is still going in  16 minutes 57 seconds [0.0027190000] (200)
PHPlist - Processing message 311 [0.2154810000] (211)
PHPlist - Looking for subscribers [0.0006560000] (215)
PHPlist - User select query select distinct u.id from phplist_listuser as listuser
        inner join phplist_user_user as u ON u.id = listuser.userid
        inner join phplist_listmessage as listmessage ON listuser.listid = listmessage.listid
        left join phplist_usermessage as um ON (um.messageid = 311 and um.userid = listuser.userid)
        where 
        listmessage.messageid = 311
        and listmessage.listid = listuser.listid
        and u.id = listuser.userid
        and um.userid IS NULL
        and u.confirmed and !u.blacklisted and !u.disabled
          [0.0003900000] (218)
PHPlist - Found them: 6 to process [0.1479300000] (220)
...
<Removed the report about the successfully sent messages>
...
PHPlist - Failed sending to janis.joplin@noa.gr [0.0008370000] (432)
PHPlist - sent 5 ETA Mon 11 Sep 20:43 sending 2091 msg/hrPHPlist - Processed 6 out of 6 subscribers [1.0021120000] (439)
PHPlist - Script stage: 5 [0.0007390000] (441)
PHPlist - 5 messages sent in 8.61 seconds (2090 msgs/hr) [0.0009100000] (444)
PHPlist - 1 failed (will retry later) [0.0005950000] (446)
PHPlist - 3 Campaign
PHPlist - 0 num_users_for_message
PHPlist - 6 batch_count
PHPlist - 200 batch_total
PHPlist - 1 sendemail returned false total
PHPlist - 0 send blocked by domain throttle
PHPlist - 0 add attachment error
PHPlist - 1 sendemail returned false
PHPlist - 0 sentastest
PHPlist - 0 invalid
PHPlist - 1 failed_sent
PHPlist - 5 Sent
PHPlist - 200 num_per_batch
PHPlist - 3 Status
PHPlist - 0 sent_users_for_message 309
PHPlist - 1 total_users_for_message 309
PHPlist - 0 max_users_for_message 309
PHPlist - 0 processed_users_for_message 309
PHPlist - 0 failed_sent_for_message 309
PHPlist - 0 sent_users_for_message 310
PHPlist - 1 total_users_for_message 310
PHPlist - 0 max_users_for_message 310
PHPlist - 0 processed_users_for_message 310
PHPlist - 0 failed_sent_for_message 310
PHPlist - 5 sent_users_for_message 311
PHPlist - 6 total_users_for_message 311
PHPlist - 0 max_users_for_message 311
PHPlist - 6 processed_users_for_message 311
PHPlist - 1 failed_sent_for_message 311
PHPlist - Finished this run [0.0185620000] (533)

I am still puzzled about the message “1 failed (will retry later)” which to my understanding denotes that phplist has not deemed the failure final.

Am I right and, if so, why does this happen?

Thanks,
Nick

Update: Today I tried adding to the test subscriber list one more fake address @gmail.com.

I found out that this address responded with a bounce and phplist processbounces job seems to have found and recognized the bounce (for the first time in my experiments):

..
PHPlist - UID10382 MSGID312
PHPlist - Deleting message 2
PHPlist - Closing mailbox, and purging messages
...
PHPlist - total of 1 subscribers processed

So, the problem is focused at the originating mail server itself, because in the case of the initial fake address, the sending server was the same with the receiving server (the recipient was on the same domain).

Thus, the question that remains open is: Why phplist does not seem to realize the failure to send to a local address and treats it as “failed (will retry later)”?

I guess I could pose the question in another way, which would cover other server cases too, those that do not produce bounces but directly respond with a 550 message: Is phplist in a position to handle negative server responses, i.e. those that directly reject the campaign mail (with a 550 message) and do not initially accept it & produce a bounce later? In my case, this case does not seem to be handled nicely. I assume that this scenario should be supported and handled (by blacklisting the recipient address).

I am also still trying to understand (as I described in an earlier post in this thread, to which I did not get a reply):

Please advise.

All the best,
Nick