Skip to content

Commit

Permalink
Remove bounce
Browse files Browse the repository at this point in the history
Unsubhandler should not record a bounce as the user unsubscribed.
  • Loading branch information
magicdude4eva committed Aug 25, 2017
1 parent 3588863 commit a9a7140
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions providers/bounce-provider-mailwizz.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,20 @@ function MailWizz_unsubscribeSubscriberUIDFromListUID($subscriberUID, $listUID,
$unsubscribeSuccess = true;

// Call the campaign-bounce endpoint
$bounceresponse = $MailWizzCampaignBounceEndPoint->create($campaignUID, array(
'message' => 'Port25 List-Unsubscribe', // max 250 chars
'bounce_type' => 'soft', // hard, soft or internal
'subscriber_uid' => $subscriberUID // 13 chars unique subscriber identifier
));

if ($bounceresponse->body['status'] == "success") {
$log->lwrite(' - Bounce-update for campaign=' . $campaignUID . ' and subscriberUID=' . $subscriberUID . ' successful=' . $bounceresponse->body['status']);
} else if ($bounceresponse->body['status'] != "success") {
$log->lwrite(' - Bounce-update for campaign=' . $campaignUID . ' and subscriberUID=' . $subscriberUID . ' failed with error=' . $bounceresponse->body['error']);
if (!is_null($campaignUID) && !empty($campaignUID)) {
$bounceresponse = $MailWizzCampaignBounceEndPoint->create($campaignUID, array(
'message' => 'Port25 List-Unsubscribe', // max 250 chars
'bounce_type' => 'soft', // hard, soft or internal
'subscriber_uid' => $subscriberUID // 13 chars unique subscriber identifier
));

if ($bounceresponse->body['status'] == "success") {
$log->lwrite(' - Bounce-update for campaign=' . $campaignUID . ' and subscriberUID=' . $subscriberUID . ' successful=' . $bounceresponse->body['status']);
} else if ($bounceresponse->body['status'] != "success") {
$log->lwrite(' - Bounce-update for campaign=' . $campaignUID . ' and subscriberUID=' . $subscriberUID . ' failed with error=' . $bounceresponse->body['error']);
}
}


} else if ($unsubscriberesponse->body['status'] != "success") {
$log->lwrite(' - Failed with status=' . $unsubscriberesponse->body['error']);
$unsubMessage = "Failed with status=" . $unsubscriberesponse->body['error'];
Expand Down
2 changes: 1 addition & 1 deletion unsubhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
preg_match('/(.*)\.(.*)\.(.*)@fbl-unsub\.bidorbuy\.co\.za/', $UNSUBSCRIBE_HANDLER_TO, $regs);

if (!is_null($regs) && !empty($regs) && sizeof($regs) == 4) {
$unsubscribe = MailWizz_unsubscribeSubscriberUIDFromListUID($regs[1], $regs[2], $regs[3]);
$unsubscribe = MailWizz_unsubscribeSubscriberUIDFromListUID($regs[1], $regs[2], null);

if ($unsubscribe[0] == true) {
$reportingInterface->logReportRecord("bounces", 1);
Expand Down

0 comments on commit a9a7140

Please sign in to comment.