CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • civimail.cronjob.php sends mail via browser not command line
Pages: [1]

Author Topic: civimail.cronjob.php sends mail via browser not command line  (Read 1746 times)

2ways

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7.15
  • MySQL version: 5.1.58
  • PHP version: 5.2.17
civimail.cronjob.php sends mail via browser not command line
October 19, 2011, 05:20:33 am
Hi Folks,

Both civimail.cronjob.php and EmailProcessor.php work, they send and process mail correctly, when I launch them from the browser, but neither work when I launch them from the command line.

My context is as follows:
1. I have bypassed authentication for civimail.cronjob.php and EmailProcessor.php as I could not get past the "ERROR: invalid username or password" error (see earlier post by me [2ways]).

2. My web host (CiviHosting) doesn't allow me to use wget (I could use 'get').

3. When I run civimail.cronjob.php from the command line, I get some timezone warnings.  For example:
"Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Hong_Kong' for 'HKT/8.0/no DST' instead in /home/euangelion/www/www/sites/all/modules/civicrm/CRM/Mailing/BAO/Job.php on line 195"

4. When I say, "running it from the command line", that includes both using a script to cd to civicrm directory and /usr/bin/php to run bin/civimail.cronjob.php and simply issuing those commands successively in the terminal.

Any thoughts on why the command line doesn't work while the browser does?

Thanks,
Lewis

2ways

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7.15
  • MySQL version: 5.1.58
  • PHP version: 5.2.17
Re: civimail.cronjob.php sends mail via browser not command line
October 19, 2011, 03:20:47 pm
Discovered a curious side issue, but the fundamental question still exists.

// side issue //

So, I was wrong that the command line isn't sending the mail.  In fact, my cron scripts are working perfectly.

The issue is a mismatch between my time zone and the server time zone.

I'm in Sydney, Australia, 3 hours (DST) ahead of the CiviHosting server in Hong Kong, and, like clockwork, a mailing I 'sent immediately' at 10:41 pm arrived promptly at 1:45 am (cron set for the 1/4 hour).

This issue has been discussed since at least 2006 (see links below).
http://issues.civicrm.org/jira/browse/CRM-2709
http://issues.civicrm.org/jira/browse/CRM-1021

I couldn't find anyway to set a time zone in CiviCRM, so I tried setting the time zone in drupal to Hong Kong time, but that didn't fix the problem, and it wouldn't be ideal anyway.

It seems Civi is scheduling things according to my local time and then executing them according to server time.  Interesting.

// fundamental question //

Given that time zone issue, it may now be obvious to others, but it isn't to me.

Why does running civimail.cronjob.php from the browser send mail immediately, while running it from the command line leaves it tied up with time zone issues?

Just to be clear, when I say 'run it from the browser', I don't mean sending the url that clears the queue, I mean:
http://my_site/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=my_user&pass=my_pass&key=my_key

Still very keen to understand what's going on.

Thanks,
Lewis

nick@kurrawong.net

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: civimail.cronjob.php sends mail via browser not command line
March 19, 2012, 05:49:15 pm
Hi Lewis,

Not sure if this issue still stands but I had a problem with mailing being able to be sent from the browser but not crontab or command line. Turns out you need \&, not just & is URLs with get variables in them for crontab and command line. Adding the backslash solved this for me.

Nick

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • civimail.cronjob.php sends mail via browser not command line

This forum was archived on 2017-11-26.