I don't see any obvious problems. I'd probably have to debug it.
To do that I'd probably
1) set the CURLOPT_RETURNTRANSFER value to true
2) increase the CURLOPT_TIMEOUT value to 60
3) set the execute value to a variable and dump it to the page like:
$curlReturn = curl_exec($ch);
4) on the send email page, write the query to the page by removing the comments in front of line 39
That should give you the query used to return the results. Try executing it in php MyAdmin directly and see if it returns the results you expect. I suspect it may shed some light on where the problem is, but you would work from there to figure out the actual problem.
I could help with this in a premier support ticket.