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!
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!