notify doesn't send email on cron
fudge714 - September 29, 2008 - 04:43
| Project: | Notify |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | matt2000 |
| Status: | closed |
Jump to:
Description
The flush email queue seems to work at sending out emails when done, but cron doesnt send out the emails itself.
Cron runs once every hour and works fine for other modules. Notify is set to send emails every week, but I have been testing it by running cron direct from the browser, which seems to do nothing (besides cron's other activities which do work).
Any ideas?

#1
For what it's worth: My experience is that cron doesn't send the e-mails if the interval is set to less than an hour. If the interval (and cron) is set to an hour or greater, the e-mails do send.
#2
I am having the same problem. I have set cron to run at 1 hour 30 minutes. cron run is confirmed in the report log.
New notifications are sent when i flush the queue, though.
What am I missing?
// $Id: notify.module,v 2.68.2.12 2008/11/08 19:38:55 matt2000 Exp $
#3
I'm also unfortunately having the same problem as above with this version. Notify seemed to work for the first day after installation, then it stopped sending emails automatically. Cron is running fine. When I manually click flush e-mail queue, the notify mails get sent.
#4
Just wanted to chime in, because I have the same problem. I've experimented with other modules to serve this purpose, but I'd really like to stick with Notify because it's significantly more lightweight and meets our (fairly simple) needs. Did some poking around to try to figure out why it wouldn't send, but I'm not getting anywhere.
#5
While we wait for someone more qualified to have a look into this, I think I may have a quick fix for this.
I'm not a programmer, but I had a peek at the notify.module file, and under the function "hook_cron", there seems to be a problem. Under the conditions for cron to kick off a notification, I'm reading it this way:
If "current_time" minus "last sent time" is greater than "send interval"
AND the "current hour" is greater than "send hour"
AND "send interval" is not -1 (ie: disabled)
Then send out the notification
From what I can tell, the problem lies with the first AND statement, as I noticed there is no "send_hour" variable in my database. In the event that the variable doesn't exist, this function sets "send_hour" to be "last sent hour". This means that if you previously had a notification go out between 23:00 and 23:59, then you won't get any more notifications, because your "current hour" will always be less than "send_hour" (which is set by default to your last sent hour: 23). Hope my non-technical way of writing this makes sense...
Anyway, cut to the chase, I couldn't see anything in the module web interface that uses or sets the "send_hour" variable, so I've deleted the line in my notify.module that says:
&& (date('G', time()) > $send_hour)and hey presto, my notify module now seems to be working fine, sending out notifications reliably now, even at 15 minute intervals etc. I can't see how this would break anything else, but I guess you should be careful on a production site until someone with a bigger brain than I either confirms that this is ok, or provides the proper fix, as I may be reading this wrong, or unaware of some other background info...
#6
This issue is fixed in the new 6.x-1.0 release.
The option to specify the send hour is now available on the notification settings form, but a default value is provided, and this is properly ignored completely when the frequency is less than one day.
Thanks to mosburger and others for tracking this bug down.
#7
Automatically closed -- issue fixed for two weeks with no activity.
#8
I am also having this issue. Currently running Drupal 6.12 with notify 6.x-1.0 on a fully updated debian 5 installation. cron runs fine but emails dont go out unless I purge them manually.