Skip to content

PHP code to move subsribers from one list to another

edited March 2021 in Contributions

Hi all,

I'm no PHP programmer but usually manage pretty well by copying and pasting snippets of code. Because I'm unwilling to use Zapier to move subscribers from one list to another (as ultimately that becomes quite expensive), I have written a bit of code that I run daily through a cron job. It works flawlessly so far, so I figured I might as well share the code. (If you're a PHP programmer and can make the code more elegant, that would be great though.)

In phpMyAdmin you can look up the numbers of your lists. They're in your Sendy database, in table lists. In there I want to move subscribers from my list 3 to my list 5. You have to look up your own numbers. I want to do that once my subscribers have received my last autoresponder. That's visible in table ares_emails. My last autoresponder message is 12. Again, you have to look up your own number.

What I want to do, is move my subscribers to list 5, as long as they're still in list 3 and have received autoresponder message number 12.

This is the code I use:


$link = mysqli_connect("localhost", "user", "password", "sendy-database");  

if($link === false){  

$sql = "UPDATE subscribers SET list = 5 WHERE list=3 AND last_ares=12";  

if(mysqli_query($link, $sql)){  



This code is in file movefrom3to5.php in my sendy directory. So the cron job I use is:

59 23 * * * php /serverpath/ > /dev/null 2>&1

Hope that helps!




  • Beautifully simple, I can see me using that. Thanks for sharing. I'd love to see this added as an optional last autoresponder step in Sendy for real.

This discussion has been closed.