We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Daily Notifications Sent Out At Strange Timing | Forum

Topic location: Forum home » Support » General Questions
Erik Zen
Erik Zen Jul 1 '11
Hi,

I know there are a lot of topics about notifications already. But I haven't seen one like the problem I'm having.

If the user check the "immediate" frequency, the notification sends out just fine. But if they check "daily," which is the default, then they don't get it --- or so I thought, until a couple of days ago, my friend said they got one that summarizes all the activities since they joined.

I know in many of the posts, it came down to the cron job. I had the system guy at my hosting company (HostGator) set up the cron for me. So I assume it's running fine. This is the line they set up:

php -q /httpdocs/ow_cron/run.php

What's that other mechanism that control the waiting-and-combing? Perhaps mine is not working right....

By the way, how do I change the default frequency for a new user?

Any input is appreciated!!

Erik
Michael Leader
Michael Jul 2 '11
You can set the timings of when to send out daily notifications from your admin panel.
Goto the admin panel
Check your installed plugins for email notifications
Check the settings for that plugin and it will show you the days and times configured for sending notifications.

How old is your site?
Erik Zen
Erik Zen Jul 3 '11
Thanks Michael!!

I was aware of that though. My site does not send the daily notifications out at those times. I sent test messages to a test login before the specified hour. No e-mail. Then I thought perhaps it takes at least a day. Still no e-mail. checked the spam. Not there. Changed (from within test login as user) to "immediate" frequency. Then send test message again, it comes in. Pretty strange....

There are a couple of values in the "missing text" under "language:

{text key='base+date_time_cap_hour'}, {text key='base+date_time_cap_minute'}

I wonder if those got anything to do with this issue?
Michael Leader
Michael Jul 3 '11
I have noticed that in the early days when people joined the verification email took up to 20 mins to be sent! It could be a combination with cron and host.

Very hard to pin point.

And apologies for stating the obvious in the plugin... Some people wouldn't look there so best to cover all bases!

Oxwall will be able to define the missing text for you mroe clearly and their use.
Den Team
Den Jul 4 '11
@Erik
How often does you cronjob run? Did you try to run mass mailing?
The only reason I see - incorrect cronjob setup.
Erik Zen
Erik Zen Jul 4 '11
Hi Addenster,

OK. I got more information from the system now. But first to answer your question: I try to run it every minute. This is what it looks like on my Control Panel:

Swtc Min H DM M DW Command
On * * * * * php -q /httpdocs/ow_cron/run.php 2>>/httpdocs/ow_cron/stderr.txt

Yes I tired to catch the error. But nothing.

I did just try to run mass mailing a few hours ago. No message until just now. I don't know if it's just a delay or because I just tried to run the run.php manually...(explained below). But private messages, when user chooses immediate frequency, still works (user gets notification e-mails.)

---------------------

I tried to login via SSH to issue the command, because the configuration manual has a test component in there that I can try. I logged on as "root" though, because that's the only user that will allow me to use SSH. (The cron job was created by another user, let's say, siteadmin.) Then when I issue run.php command, I get output as below:

OW Debug - Exception
Message: Could not instantiate mail function.
File: /var/www/vhosts/beardates.com/httpdocs/ow_libraries/php_mailer/class.phpmailer.php
Line: 595
Trace:

#0 /var/www/vhosts/beardates.com/httpdocs/ow_libraries/php_mailer/class.phpmailer.php(519): PHPMailer->MailSend('Date: Mon, 4 Ju...', '--b1_0dce26596d...')
#1 /var/www/vhosts/beardates.com/httpdocs/ow_system_plugins/base/bol/mail_service.php(260): PHPMailer->Send()
#2 /var/www/vhosts/beardates.com/httpdocs/ow_core/mailer.php(97): BOL_MailService->send(Object(BASE_CLASS_Mail))
#3 /var/www/vhosts/beardates.com/httpdocs/ow_plugins/notifications/bol/service.php(280): OW_Mailer->send(Object(BASE_CLASS_Mail))
#4 /var/www/vhosts/beardates.com/httpdocs/ow_plugins/notifications/bol/service.php(251): NOTIFICATIONS_BOL_Service->sendProcess('10', Object(NOTIFICATIONS_CMP_Notification))
#5 /var/www/vhosts/beardates.com/httpdocs/ow_plugins/notifications/cron.php(94): NOTIFICATIONS_BOL_Service->sendNotifications('10', Array, true)
#6 /var/www/vhosts/beardates.com/httpdocs/ow_cron/run.php(75): NOTIFICATIONS_Cron->run()
#7 {main}

Type: phpmailerException

There's also lots of data in the error log now. I have attached the error log file.

All this is beyond me. I hope you can help shed some light. Thanks so very much!!!!!
Attachments:
  stderr.txt (15.04Kb)
Erik Zen
Erik Zen Jul 4 '11
By the way, Hostgator guys said they do support IPv6 (error in log file says it's disabled.)
Den Team
Den Jul 5 '11
Quote from Erik Zen
Message: Could not instantiate mail function.



Here is the key!

Bu some reasons, when cron command is run, PHP can't initiate mail function. The main difference between daily and immediate settings is:

- daily: email notifications are sent by cronjob once a day

- immediate: email notifications are sent immediately after action was done by normal script.



Check your php settings when it run by cronjob from shell. function mail() is not connected with mail server in php.ini
Erik Zen
Erik Zen Jul 16 '11
Yes. Indeed my cron job wasn't really running.

I believed I solved the problem. I'll post how I resolved it. So if future members have similar issue, it maybe of help.

I really had two problems. First, those error message was caused my not having a mail user account on the server. I did a search on phpmailer error and eventually found this page that had the answer http://forums.codewalkers.com/...function-720775.html

But the thing is the subject of this post "sent out at strange timing" was the times that I manually logged into shell program and ran the cron script. Even with those errors, notifications were sent out.

So the scheduled task didn't run. I verified that by adding a line "echo 'starting script ...' >> /path/filename " in the run.php I got the idea from http://www.webhostingtalk.com/...ex.php/t-142998.html

So I asked the tech guy at Hostgator to take a look again. He fixed it. I took a look at what the difference was. Again, it's the PATH. The first tech support guy reference it the way the "administrator" of the site would. But it should be, at least for my hosting plan (a VPS), as it would be for the "root" user.

Then my echo text showed up repeatedly. Proof that FINALLY my cron job was running. I reverted the run.php back to the original one. And enjoying notifications sent out on schedule!

Thanks!!
Den Team
Den Jul 18 '11
Thanks for detailed explanation! I hope it will be very helpful for others :)