Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-7903

civimail.cronjob.php no longer sends mail

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.6
    • Fix Version/s: 3.4.1
    • Component/s: CiviMail
    • Labels:
      None

      Description

      We had a similar issue on 3.3 - civimail.cronjob.php stopped sending mail, even when called via curl with the correct user/pass/key. The job would switch to "running" but would never send mail or complete, even with multiple runs. This may be related to http://issues.civicrm.org/jira/browse/CRM-6691, although it is hard to tell.

      Trying to run the civicrm-civimail Drush command raised an additional issue that ../civicrm.config.php could not be included:
      "PHP Fatal error: require_once(): Failed opening required '../civicrm.config.php' (include_path='.:/home/clients/websites/username/sites/home.civicactions.net/modules/civicrm/:/home/clients/websites/username/sites/home.civicactions.net/modules/civicrm//packages:.:/opt/php/current/lib/php:/opt/php/pear') in /home/clients/websites/username/civicrm/nobackup/v3.3.5/bin/civimail.cronjob.php on line 49"

      I was able to workaround this error by hacking civimail.cronjob.php and hard coding the path. Note that Drush always chdirs to the Drupal root as it bootstraps, so this error occurs irrespective of the directory you run the command from.

      Trying to run civimail.cronjob.php from the command line directly, or from Drush both died with the message "<br />Sorry, could not able to locate bootstrap.inc.".

      I was able to fix this error more usefully, at least for the Drush command - see CRM-6691-cmsPath.patch. It appears that $cmsPath was getting left unset/incorrect and CiviCRM was unable to bootstrap Drupal (of course, bootstrapping Drupal is redundant from Drush, but it was failing anyway).

      Even with both of these fixes however, civimail.cronjob.php still did not actually send any mail - it simply reproduced the same behavior as the curl call. What did fix it was to bypass the civimail.cronjob.php code completely, and simply call the civicrm/mailing/queue menu item directly. You need to be logged in with an appropriate user (e.g. drush -u 1 civicrm-civimail). I am not sure why the existing code takes quite such a circuitous route - the site is already bootstrapped, CiviCRM initialized, so there is no need to go to _civicrm_init() and civimail.cronjob.php and redo all that.

        Attachments

        1. CRM-6691-cmsPath.patch
          0.5 kB
          Owen Barton
        2. CRM-6691-drush-fix.patch
          0.7 kB
          Owen Barton

          Activity

            People

            • Assignee:
              deepak Deepak Srivastava
              Reporter:
              grugnog Owen Barton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: