Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to provide bounce-status when unsubscribing from lists? #13

Closed
magicdude4eva opened this issue Aug 22, 2017 · 11 comments
Closed

Comments

@magicdude4eva
Copy link

I am using unsubscribeByEmailFromAllLists / unsubscribeByEmail / unsubscribe when processing bounces through Port25 and other mechanisms. Is there an option where unsubscribes can be marked as a "bounce" and this then be attributed to running campaigns?

@twisted1919
Copy link
Owner

@magicdude4eva - there's no such option right now, but we can add one for the subscribers endpoint, something like:

$endpoint->campaignBounce('subscriber-uid', 'campaign-uid', 'bounce-type', 'bounce-reason');

If the bounce is hard, the subscriber is also blacklisted.

Would that help ?

@masharif46
Copy link

masharif46 commented Aug 22, 2017

Bro, Thanks for Reply, where add this code ?

@magicdude4eva
Copy link
Author

magicdude4eva commented Aug 22, 2017

@twisted1919 this will help if a Port25 user adds an extra field to the delivery-server so that Port25 can keep track of the jobid (which in this case would be the campaign uid):
image

In this case, Port25 would then log the campaign-UID in the logs which I would be able to pick up and then call the campaignBounce endpoint (notice the "mailwizz-ll646mkjmbbe1" towards the end of the bounce line):
b,2017-08-22 10:45:32+0200,2017-08-22 10:45:28+0200,campaign.bounce@DOMAIN,[email protected],rfc822;[email protected],failed,5.0.0 (undefined status),smtp;550 relay not permitted,mail.icloud.co.za (41.203.18.177),relaying-issues,smtp,hermes.bidorbuy.co.za (10.0.0.83),smtp,196.11.31.239,41.203.18.177,"PIPELINING,8BITMIME,SIZE,ETRN,AUTH,STARTTLS,AUTH:PLAIN,AUTH:LOGIN",,vmta-bobe-promo-za01,mailwizz-ll646mkjmbbe1,,icloud.co.za/vmta-bobe-promo-za01,bobe-promo-za,,,,,,,,,,,,,
I would need some guideance on the choice of "bounce-type" (I could translate the Port25 ones into your ones - i.e. "relaying-issues" to whatever your equivalent is) and I would assume that "bounce-reason" is the full Port25 reason (in the above example it is "smtp;550 relay not permitted,mail.icloud.co.za (41.203.18.177)"

@twisted1919
Copy link
Owner

this will help if a Port25 user adds an extra field to the delivery-server so that Port25 can keep track of the jobid (which in this case would be the campaign uid):

Ok, that's something you can instruct people to do in the usage examples, right? And i believe the tags are parsed in the header value so i don't have to do anything here.

Bounce types are: hard, soft and internal.
Hard bounces are the ones where the domain doesn't exist anymore, the user account has been suspended, etc.
Soft bounces are only the one when users have autoresponders which auto-respond to our emails, like when they are in vacation.
Internal bounces are the ones that happen because of us, like when our own smtp server cannot delivery the email because of any reason, like because it is listed in a BL and the remote server does not accept messages from it.

Makes sense ?

@twisted1919
Copy link
Owner

"bounce-reason" is the full Port25 reason (in the above example it is "smtp;550 relay not permitted,mail.icloud.co.za (41.203.18.177)"

This is correct yes.

@magicdude4eva
Copy link
Author

@twisted1919 all of the above I can do. I will prep my changes in the meantime. Should not be too difficult and I can then test it with our campaigns once your new endpoint is up.

@magicdude4eva
Copy link
Author

@twisted1919: I am busy testing the new endpoint and perhaps I am doing something wrong:

  1. The bounce-handler fires, but calling the campaign-bounce-create causes a "Not found":
[23/Aug/2017 13:22:01] Bounce: bad-domain [email protected] via vmta-bobe-promo-za01/[email protected] jobId=mailwizz-xb040mold9ba3, dsnStatus=5.1.2 (bad destination system: no such domain)
[23/Aug/2017 13:22:01]    MailWizz: unsubscribe for [email protected]:
[23/Aug/2017 13:22:01]    - skipped: TEST JONI
[23/Aug/2017 13:22:01]    - TEST: Bounce-update for campaign=xb040mold9ba3, subscriberUID=zt462bqbl8dbc, bouncetype=hard, bouncereason=5.1.2 (bad destination system: no such domain)
[23/Aug/2017 13:22:01]    - Bounce-update for campaign-xb040mold9ba3 failed with status=Not Found
[23/Aug/2017 13:22:01]    - success: TEST-GERD
[23/Aug/2017 13:22:01]    - TEST: Bounce-update for campaign=xb040mold9ba3, subscriberUID=zm283aop2ad96, bouncetype=hard, bouncereason=5.1.2 (bad destination system: no such domain)
[23/Aug/2017 13:22:01]    - Bounce-update for campaign-xb040mold9ba3 failed with status=Not Found

My code:

...
  // now inject the configuration and we are ready to make api calls
  MailWizzApi_Base::setConfig($config);

  // Configure subscriber-end point
  $MailWizzSubscriberEndPoint = new MailWizzApi_Endpoint_ListSubscribers();

  // Configure bounce-end pointer
  $MailWizzCampaignBounceEndPoint = new MailWizzApi_Endpoint_CampaignBounces();

...

      if (!is_null($Mailwizz_CampaignUID) && !empty($Mailwizz_CampaignUID)) {
        // Call the campaign-bounce endpoint
        $log->lwrite('   - TEST: Bounce-update for campaign=' . $Mailwizz_CampaignUID . ', subscriberUID=' . $subscription['subscriber_uid'] .
          ', bouncetype=' . $Mailwizz_bounceType . ', bouncereason=' . $Mailwizz_bounceReason);

        $bounceresponse = $MailWizzCampaignBounceEndPoint->create($Mailwizz_CampaignUID, array(
          'message'        => $Mailwizz_bounceReason,         // max 250 chars
          'bounce_type'    => $Mailwizz_bounceType,           // hard, soft or internal
          'subscriber_uid' => $subscription['subscriber_uid'] // 13 chars unique subscriber identifier
        ));

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

The campaign exists:
image

and so does the subscriber:
image

@twisted1919
Copy link
Owner

@magicdude4eva - That's expected since the code for that endpoint does not exist in your app.
You can PM me so that i provide it for you if you really need it now ;)

@magicdude4eva
Copy link
Author

Doh - I am clearly not Captain Obvious right now :-(

I will drop you a Skype - still have your details...

@masharif46
Copy link

Really Nice! , I am looking for Solution , Thanks both @magicdude4eva @twisted1919

@magicdude4eva
Copy link
Author

Thanks - works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants