Autoresponder for Birthday not working
I've subscribed myself to a list with a Birthday set to the next day, to do a test.
My timezone is set. The crontab tasks are all set. But the birthday still does not work.
Any tip?
Thanks
Daniel Gomes
This discussion has been closed.
Comments
Hi Daniel,
There are no bugs or issues with Autoresponders since it was launched as a new feature a few months ago.
Is your cron job running every minute? If so, can you verify that your host allows you to run a cron job every minute?
Thanks.
Ben
Ben,
My host is an AWS EC2 Ubuntu instance.
My cronjob is like this:
*/5 * * * * php /var/www/sendy/public_html/scheduled.php > /dev/null 2>&1
*/1 * * * * php /var/www/sendy/public_html/autoresponders.php > /dev/null 2>&1
*/1 * * * * php /var/www/sendy/public_html/import-csv.php > /dev/null 2>&1
I've setup the timezone to America/Sao_Paulo at the linux shell, php.ini and at Sendy's Control Panel.
Do you think this can cause a problem?
Also at the Autoresponder E-mail, I've set it to send annually "on" Birthday date.
Any tip?
Thanks
Hi Daniel,
Did you save the cronjobs in
sudo crontab -e
orcrontab -e
? You must save it insudo crontab -e
.Thanks.
Ben
Ben,
I did using: sudo crontab -e
The scheduled e-mail works right.
The import-csv works right.
But the autoresponders don't.
What time (hour of the day) the birthday mail should be sent? When I set it to send "on" birthday.?
Thanks
Daniel Gomes
Hi Daniel,
The email should be sent at 12am on the set date.
Ben
Ben,
I mannually did some tests diggin into the autoresponders.php file.
I did add this line: echo $email;
Just after the $mail->Send(); line.
It only sends to one e-mail and stops.
If I comment the //$mail->Send(); line. It goes trough all e-mails...
Do you have any idea?
Do you have any debug instructions?
Thanks
Ben, Still could not work this out...
Looks like the method: $mail->Send(); is breaking the loop... So it only sends to the first email, and stops...
Hi Daniel,
The script should loop through all subscribers that needs an autoresponder to be sent to them, if it breaks at
$mail-Send();
, either something is wrong, or there are no other subscribers that needs an autoresponder to be sent to them.Can you test by creating a Drip Campaign that sends an email immediately when you sign up? Then sign up to that list to see if you receive the autoresponder email?
Thanks.
Ben
Hey Ben,
I've created a list with four e-mails of mine. All with the same b-day date.
The Drip Campaign is working well. Jus tested... Deleted all 4 e-mail from the test list and sign up with the 4 again.
I was thinking this could be any server config issue. What do you think?
Thanks
Daniel
Hi Daniel,
Have you by any chance set your timezone in Settings?
Thanks.
Ben
I did.
Ben, just find out the problem.
Although I did set the timezone settings, looks like phpmailer send() method calls this php function: date_default_timezone_set.
And after the first email is sent, the day for the next ones was changing...
So it was sending only to the first one.
To solve I add this line, before set the day and month to compare:
date_default_timezone_set('America/Sao_Paulo');
$cf_day = strftime("%d", $custom_fields_array[$i]);
$cf_month = strftime("%b", $custom_fields_array[$i]);
Thanks
Thanks Daniel,
You're right, if 2 subscribers share the same 'Birthday', only one will receive it. You should use this code instead:
date_default_timezone_set($user_timezone);
instead ofdate_default_timezone_set('America/Sao_Paulo');
so your timezone will be retrieved from whatever you've set in Settings.Thanks.
Ben
Cool.
Ben, Another sugestion I would made is to select the birthdays subscribers in Mysql, instead of select all subscribers, and loop through them.
It would use less CPU and would process faster.
Thanks
Daniel