Skip to content

Using Mandrill webhook for Bounces & Complaints

2

Comments

  • I am not getting any reply from Ben send email no reply can anybody help on it

  • what's up with this? mandrill is price competitive and for us works much better than moody SES (which we keep only in case of need be). Is there any way to do this all with mandrill?

  • Tidied up a few things and done some testing with 1.1.9.2.

    You need to add two webhooks to Mandrill as in the screenshot and upload the two files.
    One for "soft bounces, hard bounces and rejections" and another for complaints.

    https://www.dropbox.com/s/ht7l5eoq0nio1pz/sendy-mandrill-webhooks-for-v1.1.9.2.zip

  • Just to add on the scottie1010's great work, you would need to add the below code in both bounces.php and complaints.php for it to work:

    if(get_magic_quotes_gpc()){
      $json = stripslashes($_POST['mandrill_events']);
    }else{
      $json = $_POST['mandrill_events'];
    }
    
    // Parse the POST to json
    $data = json_decode($json, true);
    

    Hope it helps.

  • Actionx, get_magic_quotes_gpc() always return false on PHP 5.4 and above.

    scottie1010, one question: You added 'Unsubscribe' to the complaints webhook. I thought that unsubscriptions where handled by Sendy by adding the tag, am I wrong?

  • Is this working?

  • It works with 1.1.9.2, have not yet tried with the latest version (1.1.9.4) but the change log mentions bounces/complaints so I guess a few tweaks will be required.

    enegri - I used the original configuration screenshot. I only have trigger on "spam" on my complaints and "hard/soft_bounce, reject" on my bounces.

  • Looking at the changes in the original files it would seem that the current version will still work however I have not sent a campaign recently to test.

  • This is great and very useful, thanks!

  • Scottie1010 i don't think your scripts work as of 1.1.9.5 although ill run some more tests.

    If i do find issues ill post any fix here, but as i say it may just be me being an idiot!

  • Used ActionXs fix using stripslashes()

    So i replaced :

    $data = json_decode($_POST['mandrill_events'], true);

    With :

    // Remove escape chars from JSON
    $json = stripslashes($_POST['mandrill_events']) ;
    // Parse the POST to json
    $data = json_decode($json, true);

  • Hello guys, I'm new here. Can anyone please point me in the right direction for Madrill bounces to work with Sendy? So far nothing of the above suggestions has worked for me. Anyone got it working with 1.1.9.5? If so can you explain which file worked for you? There are different files and code replacements and edits, it has become a real struggle. Thank you!

  • Is there anyone here already using script provided by scottie1010 :
    https://www.dropbox.com/s/ht7l5eoq0nio1pz/sendy-mandrill-webhooks-for-v1.1.9.2.zip
    with some fix :

    actionx June 23 :
    Just to add on the scottie1010's great work, you would need to add the below code in both bounces.php and complaints.php for it to work:

    if(get_magic_quotes_gpc()){
    $json = stripslashes($_POST['mandrill_events']);
    }else{
    $json = $_POST['mandrill_events'];
    }

    // Parse the POST to json
    $data = json_decode($json, true);

    And some fix by :
    zakclayton October 10 :
    Used ActionXs fix using stripslashes()

    So i replaced :

    $data = json_decode($_POST['mandrill_events'], true);

    With :

    // Remove escape chars from JSON $json = stripslashes($_POST['mandrill_events']) ; // Parse the POST to json $data = json_decode($json, true);

    But there are no answer or reaponse for question :
    peppies November 8 :
    Hello guys, I'm new here. Can anyone please point me in the right direction for Madrill bounces to work with Sendy? So far nothing of the above suggestions has worked for me. Anyone got it working with 1.1.9.5? If so can you explain which file worked for you? There are different files and code replacements and edits, it has become a real struggle. Thank you!

  • Sorry.. forget to type the question complete.... :)

    So after this add script from scottie1010 and some fix from the other. My question still :
    Does anyone here try it on sendy version 1.1.9.5 ?

    Thanks

    Wendi

  • Hi There,
    Just configure sendy 1.1.9.5 with updated bounces.php and compliants.php but they don't track correctly bounces and/or compliants. Anyone update those files? Thank you!

  • Hi,
    I am trying to update to 2.0.1.
    Anyone know if this still works or if any change is required?
    Thanks

  • Found another one, 6 months old:
    https://sendy.co/forum/discussion/3831/sendy-mod-webhooks-for-non-ses-event-handling

    A lot of options, but not sure which one is good.
    Ben, are you reading this?

    Thanks

  • edited March 2015

    Guys,

    So which version or can anybody share a working Webhook for Sendy 2.0.1,

    Also @BlaineMoore started a GITHUB

    https://github.com/BlaineMoore/sendy-webhooks

    Maybe we could update the Github.

    UPDATE: 3/8/2015
    But I can confirm that this one is working for me running Sendy 2.0.1
    https://sendy.co/forum/discussion/2192/sendy-mod-mandrill-webhooks-to-track-bounces-and-spam-complaint

    The ReadMe needs a little bit more clarification, "If you use Sendy to send commercial emails through Mandrill, it's a
    good idea mark deferral emails as a soft bounce".

    Where is this "mark deferral emails as soft bounce"- Setting in Mandrill? Does Anyone have a idea?

  • Well... with this file found here: https://sendy.co/forum/discussion/2192/sendy-mod-mandrill-webhooks-to-track-bounces-and-spam-complaint

    In the php file, I've seen the word "complaint" written as "compliant".

    Was this intended and should we keep the file that way or was this a typo?

    Because compliant is like everywhere in the file.

    I'm not sure which hook works anymore?

    Anyone could tell us which one is flawless right now?

  • @dralex... that's weird... can anyone post a fully working version of this mod? I tested it and it doesn't seem to track complaints well... only bounces.

    https://sendy.co/forum/discussion/2192/sendy-mod-mandrill-webhooks-to-track-bounces-and-spam-complaint

  • I just bought sendy hoping i can get it to work with mandrill. I installed those files the link above and the its not tracking the bounces.

    My php reads "compliant" also. Should I change that to complaint?

  • edited August 2015

    The bounces, soft bounces etc are not working for me. When I create the webhook in mandrill it generates a key do i have to put that anywhere on my side? I clicked "send test" from the webhook i created and it says "Successfully posted 5 test events to http://mydomain.com". Im lost right now.

  • Does anybody know how to get this working? Im emailing hello@sendy.co and they arent answering me either.

  • Hi @BigEfromDaBx,

    This is a third party integration/plugin with another SMTP provider, you'll need to get support from the original developer of this integration/plugin.

    Or try this integration with Mandrill by Blaine Moore → https://github.com/BlaineMoore/sendy-webhooks (on Github)

    Thanks.

    Best regards,
    Ben

  • Hi all,

    I fixed up a few things in the code to get it to work:

    In /includes/db.php:

    Line 79: if($bounce_soft >= $bounce_limit)

    Should be: if($bounce_soft >= $webhooks_bounce_limit)

    The global $var was incorrectly referenced, hence the soft bounce limit was not working.

    In mandrill.php:

    Line 30: case "soft-bounce"

    Should be: case "soft_bounce"

    Mandrill webhook send this with an underscore, not a hyphen.

    I made these 2 changes, and then tested all 3 webhooks separately:
    1) Sent hard bounce test, Mandrill correctly changes subscriber to "Bounced"
    2) Sent soft bounce with a limit of 3, Mandrill correctly keeps the subscriber until the limit is reached, at which point it changes the subscriber to "Bounced"
    3) Sent a spam report, Mandrill correctly changes subscriber to "Marked as spam"

    I hope this helps. If you want to change status to anything other than "Bounced", just modify the SQL statement to update the relevant field.

  • Thank you. I will give it a try. Sorry for the late response.

  • if I setup my webhooks folder in the root of my site (sendy is also in the root of my site) does my mandrill webook point to http:/mysite.com/webhooks/mandrill.php?

  • I tried it again using the above link by Blaine Moore.

    I did the two changes the @daihoang suggested and still cannot get this to work. My webhook is connecting to my site from mandrill when i test it. But its still not updating the emails. I get the following errors from the error_log

    [14-Sep-2015 20:20:21 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
    [14-Sep-2015 20:20:21 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo_mysql.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
    [14-Sep-2015 16:20:21 America/New_York] PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'mysite'@'localhost' (using password: NO) in /home/mysite/public_html/webhooks/includes/db.php on line 29
    [14-Sep-2015 16:20:21 America/New_York] PHP Warning: mysqli_set_charset(): Couldn't fetch mysqli in /home/mysite/public_html/webhooks/includes/db.php on line 36
    [14-Sep-2015 16:20:21 America/New_York] PHP Warning: mysqli_query(): Couldn't fetch mysqli in /home/mysite/public_html/webhooks/includes/db.php on line 56
    [14-Sep-2015 20:23:39 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
    [14-Sep-2015 20:23:39 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo_mysql.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
    [14-Sep-2015 16:23:39 America/New_York] PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'mysite'@'localhost' (using password: NO) in /home/mysite/public_html/webhooks/includes/db.php on line 29
    [14-Sep-2015 16:23:39 America/New_York] PHP Warning: mysqli_set_charset(): Couldn't fetch mysqli in /home/mysite/public_html/webhooks/includes/db.php on line 36
    [14-Sep-2015 16:23:39 America/New_York] PHP Warning: mysqli_query(): Couldn't fetch mysqli in /home/mysite/public_html/webhooks/includes/db.php on line 56

This discussion has been closed.