Exporting “Do Not Contact” List from Mautic 2

Mautic, Sendy , , , , , ,

If you’re looking to use a different email marketing system, or use another in conjunction with Mautic, you will need to keep the Do Not Contact / Do Not Email / Suppression List / Unsubscribe status list up to date.

You have a couple of options to do this. The first is this, a manual export from the Mautic Database of the emails set to Do Not Email. In my case I am trying to synchronize my Sendy installation with my Mautic one. I have large lists in both already, so I need to have them up to date from a point, after which I can set up a Webhook to trigger the unsubscribe between Mautic and Sendy.

Run the following code on your Mautic Database and export the results as a CSV file (using PhpMyAdmin)

SELECT `leads`.`email`
FROM `lead_donotcontact`
INNER JOIN `leads` ON `lead_donotcontact`.`id` = `leads`.`id`
WHERE `leads`.`email` != "";

Create a new list in Sendy, import all the email addresses (Call it something you’ll remember like “Do not Contact List”). Click the “Mass Unsubscribe” and that’s it. You should have an up-to-date contact database and you won’t annoy anyone by emailing them when you shouldn’t be!


Sendy Suppression List Hack

If you would like to go a step further and ensure that those users are unsubscribed from ALL lists, then you’ll have to run a little SQL on the Sendy database. The reason for this, is that Sendy unsubscribes users based per list, not globally. As of writing this, I am not aware of a global suppression list in Sendy. That being said, the BOUNCED status in the Sendy DB acts in this way. If an email has bounced on any list, they will not be emailed again. So if we set users status to BOUNCED, then they’ll never be emailed.

Get the number of the list that you would like to set users to bounced. (The list you setup above), then update the query below with the List ID and run the code on the Sendy DB. The list ID can be found by clicking on the list in the Sendy GUI and looking at the URL.

UPDATE `subscribers` SET `bounced`=1 WHERE `list`=12

Make sure you update the LIST ID before running this code.

Thanks to shumilica on the Sendy forum for the fix: https://sendy.co/forum/discussion/comment/5536#Comment_5536