Need help with cron mailer not sending

JackGoa

Member
Hi, I'm starting a fresh thread on this, as this is a spin off from a different issue I received help with.

I've got some cron emails that go out once a day. The cron job runs, I get the notifications. It will only send to 3 or 4 emails on it's own though. I need to run them manually daily to get them to send out.

I don't have pre-filters on the list and I have set the access to public for 'view records', 'edit records', 'view list' and 'add records'.

I've gone over my conditions about 50 times by now to make sure there are no errors.

I have 10 of these setup to run 5 minutes apart, once a day. they basically go through a list of people and send them reminders based on what the previous reminder was they received and also the time at which they originally filled in the form on my site. Here is a sample from one of them:

PHP:
$date1 =new DateTime();
$date2 =new DateTime('{ahsa_leads___date_time}');
$timediff = $date2->diff($date1)->format("%a");

return '{ahsa_leads___followed_up_raw}' == 'no' && '{ahsa_leads___form_returned_raw}' == 'no' && '{ahsa_leads___end_result_raw}' == 'pending' && ($timediff > 2 && $timediff < 5);

I honestly do not know what else to do to troubleshoot this. My $timediff overlaps a bit as I also found that it won't send to people that are more than 2 or 3 days older for instance, it only sends to them if they're older than 4 days. The next condition will send to people > 4 && < 7 and so on.

I'm considering removing the condition checking at what stage they are in the follow up. that would be the '{ahsa_leads___followed_up_raw}' == 'no' part.

Any suggestions would obviously be greatly appreciated, I don't really know where else to ask?
 
Debugging cron tasks can be problematic, as it's hard to get all the info you need. Just doing the usual "var_dump(...);exit;" isn't very helpful.

What might help you is jdump ...

http://extensions.joomla.org/extension/j-dump

... and use dump(...) in your condition code. Assign your placeholders to values, and dump those ...

Code:
$myDate = '{ahsa_leads___date_time}';
dump($myDate);
$myFollowup = '{ahsa_leads___followed_up_raw}';
 dump($myFollowup);

... etc.

Then for testing, set your time interval down to 1 second, and add a query string trigger, so you can fire the task on demand by just adding that to a URL.

-- hugh
 
ok cool, I understand the concept of doing that dump, but how and where do I view it? How do I place that code and where do I view it? Sorry if it's something obvious I'm asking, but that is the extent of my coding knowledge and this is why I love fabrik because it shows me how these things work.
 
You'd put the dump() in your condition code. Install jdump and read the docs on it. It just pops up a window when you load the page, if anything calls dump().

-- hugh
 
It's REALLY simple. Just dump() whatever you want to see ...

http://screencast.com/t/7PHdxqeJ

... and a window will pop up after the page loads, showing you the content of whatever you dumped.

So in that example, there's 3 records in the table, it prints out the {fab_repeat___name} for each one.

So you can dump out your date difference and status elements for each row being processed, and figure out whats going on.

-- hugh
 
Ok I think I got it working. I also accessed it using a different browser so that it would see me as a 'public' user.
These are the dumps I setup:

PHP:
$date1 =new DateTime();
$date2 =new DateTime('{ahsa_leads___date_time}');
$timediff = $date2->diff($date1)->format("%a");
dump($timediff);
$followup='{ahsa_leads___followed_up_raw}';
dump($followup);
$freturned = '{ahsa_leads___form_returned_raw}';
dump($freturned);
$endresult = '{ahsa_leads___end_result_raw}';
dump($endresult);

In the screenshot you can see some of my results. As far as I can make out, my $timediff is worked out wrong? I don't understand why it would send at all then when I run it manually?
 

Attachments

  • a_screenshot_01.jpg
    a_screenshot_01.jpg
    53.7 KB · Views: 96
It does in fact seem to calculate the $timediff correctly, even though in the example below I got 94 instead of 93, but that might be because of the times:

PHP:
$date1 =new DateTime();
dump($date1);
$date2 =new DateTime('{ahsa_leads___date_time}');
dump($date2);
$timediff = $date2->diff($date1)->format("%a");
dump($timediff);
$followup='{ahsa_leads___followed_up_raw}';
dump($followup);
$freturned = '{ahsa_leads___form_returned_raw}';
dump($freturned);
$endresult = '{ahsa_leads___end_result_raw}';
dump($endresult);

So all I can think is that there is somehow a permissions issue. It runs fine when I do it manually, which is of course a bit of a pain to go do every day.

I'm running out of ideas on how to troubleshoot this.

Hugh, how did you figure out that missing file issue in my other thread yesterday?
 

Attachments

  • a_screenshot_01.jpg
    a_screenshot_01.jpg
    38.8 KB · Views: 78
I just discovered something. Remember back when Joomla upgraded to 3.5? There was some issue with data collation? I was having some or other issue and I temporarily set the PHP version for the hosting account to 5.3.27. I discovered now it was still on that setting.

I changed it back to 5.6. So lets see if it runs by itself tonight. Holding thumbs it is that simple!
 
Ok, so this is an example of the email I receive when it runs automatically:

Code:
updates 0 records email listid = 3 SELECT SQL_CALC_FOUND_ROWS DISTINCT `ahsa_leads`.`id` AS `ahsa_leads___id`, `ahsa_leads`.`id` AS `ahsa_leads___id_raw`, `ahsa_leads`.`date_time` AS `ahsa_leads___date_time`, `ahsa_leads`.`date_time` AS `ahsa_leads___date_time_raw`, `ahsa_leads`.`name` AS `ahsa_leads___name`, `ahsa_leads`.`name` AS `ahsa_leads___name_raw`, `ahsa_leads`.`surname` AS `ahsa_leads___surname`, `ahsa_leads`.`surname` AS `ahsa_leads___surname_raw`, `ahsa_leads`.`cell_number` AS `ahsa_leads___cell_number`, `ahsa_leads`.`cell_number` AS `ahsa_leads___cell_number_raw`, `ahsa_leads`.`work_number` AS `ahsa_leads___work_number`, `ahsa_leads`.`work_number` AS `ahsa_leads___work_number_raw`, `ahsa_leads`.`email` AS `ahsa_leads___email`, `ahsa_leads`.`email` AS `ahsa_leads___email_raw`, `ahsa_leads`.`consent` AS `ahsa_leads___consent`, `ahsa_leads`.`consent` AS `ahsa_leads___consent_raw`, `ahsa_leads`.`traffic_src` AS `ahsa_leads___traffic_src`, `ahsa_leads`.`traffic_src` AS `ahsa_leads___traffic_src_raw`, `ahsa_leads`.`followed_up` AS `ahsa_leads___followed_up`, `ahsa_leads`.`followed_up` AS `ahsa_leads___followed_up_raw`, `ahsa_leads`.`form_returned` AS `ahsa_leads___form_returned`, `ahsa_leads`.`form_returned` AS `ahsa_leads___form_returned_raw`, `ahsa_leads`.`end_result` AS `ahsa_leads___end_result`, `ahsa_leads`.`end_result` AS `ahsa_leads___end_result_raw`, `ahsa_leads`.`comment` AS `ahsa_leads___comment`, `ahsa_leads`.`comment` AS `ahsa_leads___comment_raw`, `ahsa_leads`.`id` AS slug , `ahsa_leads`.`id` AS `__pk_val` FROM `ahsa_leads` ORDER BY `ahsa_leads`.`date_time` ASC,`ahsa_leads`.`followed_up` ASC,`ahsa_leads`.`date_time` ASC

This is an example of the exact same cron run manually, right after it runs automatically:

Code:
updates 0 records email listid = 3

I'm not including an example with some of the few emails it does send out to, in order to protect those emails from spam harvesters.
 
Hugh, how did you figure out that missing file issue in my other thread yesterday?

Because the param names in your plugin settings were missing the [x] numbered suffix, which meant that it wasn't loading our JForm class override.

-- hugh
 
oh ok. well I uploaded a new copy and just hope it's all there. I still can't figure out why it would not put all the files in the right place if I download it straight to my server from Github, and unzip it to the right place.
 
Can't help ya there. The file is definitely in github, and definitely in the master.zip, so something went wrong on your end.

-- hugh
 
Ok got an email notification of some emails going out tonight automatically. Much more than usual. Will investigate in the morning as my list is a bit messed up now due to the emails not having gone out in the past.

Too many conditions to be met. $timediff plus that followed_up field.

I'm trying to figure out a logical way to simplify all those conditions.

Is there some kind of plugin which can be used to synchronise a fabrik list with some or other email auto responder type system whereby I can setup email campaigns and auto responders?

I'm beginning to think I'm over complicating the system I'm trying to build while there might be a simpler solution.



bj?rn
- on tapatalk
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top