PMTA bounce issue with bounce handler script

dukec

Member
Hi mate,
Today we've solved bounce handler issue for our customer and share some my jobs

Bounce handler script https://github.com/magicdude4eva/port25-bouncehandler
Environment: PMTA 4.5

Issue:
This script will handle bounce data from PMTA directly.


The problems and solution:

PMTA bounce handler with script issue

1. Mailwizz API configure wrong
On setup.php file, API url should be <yourdomain>/api/index.php
2. Mailwizz API only works on dedicated customer that API key belongs
Solution:
This script uses two APIs for bounce processing: unsubscribe and bounce.
I’ve by pass core API to make it work for all customer with one of customer’s API key.

@twisted1919 is there any solution to use API globally (API for all customer - useful in some case) ?

3. PMTA configure
Read setup.php for more information
<acct-file |/usr/local/bin/php /opt/pmta/bouncehandler/bouncehandler.php>
records b
record-fields b timeQueued,bounceCat,vmta,orig,rcpt,srcMta,dlvSourceIp,jobId,dsnStatus,dsnMta,dsnDiag
</acct-file>

In order PMTA process jobId, must set this configure: process-x-job = yes
Inside this section
<source 0/0>
process-x-job = yes
</source>

In Delivery server setting, add this header:
x-job mailwizz-[CAMPAIGN_UID]

4. Modifying logic in bouncehandler.php and bounce-provider-mailwizz.php

Bouncehandler.php
PMTA process header and bounce origin email address never match the logic for processing bounce

See this line
if (in_array($bounceRecord[PORT25_OFFSET_BOUNCE_SOURCE_EMAIL], $origMailWizzZA)) {
the value of source email look like this: bounce-a=b-com@domain.ltd, it dedicated by each email so this condition always false.
By pass it by set always true then bounce will processed


bounce-provider-mailwizz.php
Modify this file to change logic for hard and soft bounce:
- hard bounce: unsubscribe subscriber
- soft bounce: call bounce api only

The problem on hard bounce is unsubscribed email will never process to blacklist so need move the bounce processing before unsubscribe processing step.

Hope it help you in some case.
Thanks!
 
Yes...it works great @cong! We didn't need to do any of your additional modifications to get it to work right out of the box. It just "works". We did modify the hard/soft bounce rules slightly.
 
Hi mate,
Today we've solved bounce handler issue for our customer and share some my jobs

Bounce handler script https://github.com/magicdude4eva/port25-bouncehandler
Environment: PMTA 4.5

Issue:
This script will handle bounce data from PMTA directly.


The problems and solution:

PMTA bounce handler with script issue

1. Mailwizz API configure wrong
On setup.php file, API url should be <yourdomain>/api/index.php
2. Mailwizz API only works on dedicated customer that API key belongs
Solution:
This script uses two APIs for bounce processing: unsubscribe and bounce.
I’ve by pass core API to make it work for all customer with one of customer’s API key.

@twisted1919 is there any solution to use API globally (API for all customer - useful in some case) ?

3. PMTA configure
Read setup.php for more information
<acct-file |/usr/local/bin/php /opt/pmta/bouncehandler/bouncehandler.php>
records b
record-fields b timeQueued,bounceCat,vmta,orig,rcpt,srcMta,dlvSourceIp,jobId,dsnStatus,dsnMta,dsnDiag
</acct-file>

In order PMTA process jobId, must set this configure: process-x-job = yes
Inside this section
<source 0/0>
process-x-job = yes
</source>

In Delivery server setting, add this header:
x-job mailwizz-[CAMPAIGN_UID]

4. Modifying logic in bouncehandler.php and bounce-provider-mailwizz.php

Bouncehandler.php
PMTA process header and bounce origin email address never match the logic for processing bounce

See this line
if (in_array($bounceRecord[PORT25_OFFSET_BOUNCE_SOURCE_EMAIL], $origMailWizzZA)) {
the value of source email look like this: bounce-a=b-com@domain.ltd, it dedicated by each email so this condition always false.
By pass it by set always true then bounce will processed


bounce-provider-mailwizz.php
Modify this file to change logic for hard and soft bounce:
- hard bounce: unsubscribe subscriber
- soft bounce: call bounce api only

The problem on hard bounce is unsubscribed email will never process to blacklist so need move the bounce processing before unsubscribe processing step.

Hope it help you in some case.
Thanks!

Very quick Cong.
 
Update:
The bounce handler searching email bounce log from all lists and processed it, this is incorrect and make the bounce log amount higher than usual.
Fixed it by compare list_uid from list subscriber and process only matching list uid.
 
Back
Top