We've used this module in the past, and it has worked....the recent changes to the admin config now don't require a user name and password. And now the scheduled mailings do not send out

Not 100% sure if this is connected to the issue but would appreciate some feedback/thought on the matter.

After running Drupal cron, the mailing will show a status of "Running" and reports a correct start time but never completes.

I can confirm that my CiviCRM cron config is good....
Following the instructions on the CiviCRM mailing wiki: http://wiki.civicrm.org/confluence/display/CRMDOC/CiviMail+Installation

I can test my CiviCRM cron config with the command url:
Drupal: http://[SITEROOT]/sites/all/modules/civicrm/bin/cron.php?name=username&pass=password&key=site-key

And the mailing goes out no errors, emails received.

Comments

rviner’s picture

I have the same problem. Looking at the Wiki it mentions that in order for Civicrm mail to work you must create a civicrm user with permissions to:

- view all contacts
- access CiviCRM
- access CiviMail

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviMail+Installation

Since the update to the module has removed the passing through of a user this may be the issue. I experienced the same issue with the previous version of this module when my user didn't have the permissions above enabled.

I am also looking for feedback on this issue?

kreynen’s picture

This was discussed in detail #2048405: Since updating to 7.x-2.0-beta1, cron no longer gets run, but I'm flagging that issue as the duplicate since it has a few different issues in it. Please review that for more details.

The way the 1.x branch worked, it simply used drupal_http_request and the same URL that you'd run from cron. I think the chain of events that led to this problem involves writing the 2.x branch of civicrm_cron while a bug existed in CiviCRM that was resolved by requiring CiviMail cron functions as a privileged user.

http://issues.civicrm.org/jira/browse/CRM-12648

I'd like to avoid going back to running cron using drupal_http_request because the username and password of an actual user are passed in cleartext and can end up in the logs of several systems. I've been looking at https://github.com/civicrm/civicrm-drupal/blob/7.x-master/drush/civicrm.... and
https://github.com/civicrm/civicrm-core/blob/master/CRM/Mailing/BAO/Mail... to figure out how to bypass the security check and/or create a session in a way that works for CiviCRM, but I haven't had much time to work on this.

In the meantime use https://drupal.org/node/2048405#comment-7687717 as a work around.

kreynen’s picture

Status: Active » Needs work

I believe this is fixed in the beta2 release I just rolled. I added the username and pass fields back to the admin UI in a section specific to CiviMail. If the civicrm_cron_username variable is set, we try to authenticate using that username and pass. If it's left empty, the cron jobs are run without a username and pass.

  if (variable_get('civicrm_cron_username', NULL)) {
    CRM_Utils_System::authenticateScript(TRUE, variable_get('civicrm_cron_username', NULL), variable_get('civicrm_cron_password', NULL));
  } else {
    CRM_Utils_System::authenticateScript(FALSE);
  }

I'd still like to remove the username and password requirement, but in the current releases CiviCRM the CiviMail job uses that user to generate an authenticated session. Hopefully we'll be able to remove this again in future releases.

markusa’s picture

I agree the long term philosophy of not including a username or password is the right way. Perhaps in time patches/techniques in CiviCRM will make this work for CiviMail. Thanks for the code.

kreynen’s picture

Status: Needs work » Postponed (maintainer needs more info)

I'm not going to look at this again until CiviCRM 4.4