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) »
  • Scheduled mail not sending - need a valid username and password to execute
Pages: [1]

Author Topic: Scheduled mail not sending - need a valid username and password to execute  (Read 5347 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
Scheduled mail not sending - need a valid username and password to execute
October 16, 2011, 06:28:58 pm
Well...it is with great reluctance that I post.  Everyone and their dog has had some kind of problem like this and I feel like there must a be a solution for mine out there somewhere, but I can't find it...so here we go...

I've got the latest versions of Drupal and CiviCRM and I'm with CiviHosting, so I'm confident the server-side settings will be configured helpfully.

The problem: I can't seem to make scheduled mailings send.

However I try to run civimail.cronjob.php, I receive the error:
ERROR: Invalid username and/or password

I have run it via url, like this:
euangelion.org.au/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=my_user&pass=my_pass&key=my_key

directly from the command line:
cd to civicrm
php bin/civimail...

with a shell script, etc.  Always the same error message.

My username, password, and site key are entirely alphanumeric.

I have followed the instructions at:
http://wiki.civicrm.org/confluence/display/CRMDOC40/Step-by-step+Return+Channel+on+Drupal+-+Google+Apps+-+CentOS

and

http://en.flossmanuals.net/civicrm/ch042_system-configuration/

and read lots of posts in these forums as well as several blogs

I've been through Xavier's checklist post at the top of this board and confirmed that I have followed the instructions on those matters from the two pages above.

Bottom line:
I receive the error and mail does not go anywhere.

Any help would be greatly appreciated.

Thanks,
Lewis

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Scheduled mail not sending - need a valid username and password to execute
October 16, 2011, 07:03:56 pm

what username and password are you using? This should be the username and password of an account on your website. Can you double check that. Try logging into your website using that username / password

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

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: Scheduled mail not sending - need a valid username and password to execute
October 16, 2011, 08:17:21 pm
Thanks.

I have repeatedly checked that point.

The username and password are for a valid Drupal user who is also a contact in civi. That user's email address is my returned mail account at gmail and that user (in my desparation) now has administrator privileges, which includes, of course, 'access to civicrm' and 'edit all contacts' permissions.

I have just logged I as that user to confirm all of this works.

Hope that clarifies things. Thanks for the help.

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: Scheduled mail not sending - need a valid username and password to execute
October 16, 2011, 08:51:16 pm
Hmm...

I will now half-eat my previous words...

My user is everything I said above, however, I just noticed that when in the CiviCRM module, my civimail user does not have access to everything my admin user has access to.

The civimail user can only see Home, Search, Contacts, and Help from the Civi menu.  The user can edit all contacts (just edited some contacts), but can't seem to administer stuff.

The user is in the Administrators group and that group has been assigned administrator privileges in the Access Control panels.  All of that is part of the default set up.

Why is this user different from my original admin user and how can I change that?

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: Scheduled mail not sending - need a valid username and password to execute
October 17, 2011, 10:08:42 am
Ahh...

The good news...
Just found this thread and fixed my menu problem:
http://forum.civicrm.org/index.php?topic=21424.0

The bad news...
Because it was just a display issue, rather than a permissions issue, it hasn't changed my civimail situation

As far as I can tell, everything remains as it was in my original post.

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: Scheduled mail not sending - need a valid username and password to execute
October 17, 2011, 08:26:04 pm
Well, in an effort to be able to send mail while I try to solve this problem, I have turned off the authentication process in civimail.cronjob.php and EmailProcessor.php.

It all works fine when I bypass the username and password.

As it is, I'd rather not do that, but I need to be able to send mail from the database.

Still very keen for suggestions on this.

Thanks,
Lewis

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Scheduled mail not sending - need a valid username and password to execute
October 19, 2011, 11:06:23 am
Hello 2ways,

I'm having the same problem. Civicrm/bin/EmailProcessor.php (civicrm 3.4.6) has only 1 choice for php_sapi_name: cli.

Check your php_sapi_name. Add
Code: [Select]
echo "php_sapi_name = " . php_sapi_name() . "\n"; to EmailProcessor.php to find out what your php_sapi_name is. Mine was cgi-fcgi. It needs to be cli. In my system I found my php-cli, and then called the script with the full path to php-cli. Running again, the php_sapi_name is indeed cli.

Then it barfed when it hit the next line
Code: [Select]
require_once ("bin/cli.php");. There is no civicrm/bin/bin directory. I edited that line to be:
Code: [Select]
require_once ("cli.php");

Closer, but it still is not running all the way through.

cos

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Scheduled mail not sending - need a valid username and password to execute
October 19, 2011, 11:13:42 am
Hello 2ways,

In cli.php
Code: [Select]
require_once ("./civicrm.config.php"); doesn't work because civicrm.config.php is up one directory. I changed it to:
Code: [Select]
require_once ("../civicrm.config.php");Now a big nasty error:

PHP Fatal error:  Cannot redeclare _PEAR_call_destructors() (previously declared in /opt/php/pear/.packages/php-pear-1.9.0-gm1/PEAR.php:773) in /home/clients/websites/w_gincom/public_html/gincom/sites/all/modules/civicrm/packages/PEAR.php on line 811

cos

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Scheduled mail not sending - need a valid username and password to execute
October 19, 2011, 11:57:10 am
Hi 2ways,

It looks like the PHP Fatal error:  Cannot redeclare _PEAR_call_destructors() error is fairly common. I followed the advice given here:
http://forum.civicrm.org/index.php/topic,3708.msg77391.html#msg77391

And ran grep "PEAR_call_destructors" in my public_html directory. Found several old copies of civicrm. Removed them. Now when I run grep it only finds the PEAR_call_destructors in the current module/civicrm directory. Restarted Apache. Error is still there.

So there are NO conflicting files, and PHP is barfing.

cos

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Scheduled mail not sending - need a valid username and password to execute
October 19, 2011, 03:07:58 pm
Hey 2ways,

Got rid of my second PEAR.php. Didn't realize there was one in the system. Read this post:
http://forum.civicrm.org/index.php/topic,3708.msg16426.html#msg16426
Then symlinked from civicrm up to the system file (after checking that they are identical).

I finally caught up to you. That is, I was getting a different yet similar error, and now I am getting the "ERROR: Invalid username and/or password".

cos


GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Scheduled mail not sending - need a valid username and password to execute
October 19, 2011, 03:58:11 pm
Hello 2ways,

After searching the forum for "ERROR: Invalid username and/or password", I found a few results. The best for me was:
http://forum.civicrm.org/index.php/topic,7879.msg34209.html#msg34209

I pretty much followed what it said, and it solved the problem.

cos

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: Scheduled mail not sending - need a valid username and password to execute
October 19, 2011, 10:21:12 pm
Thanks, Cos.

I'm glad you've got your problem fixed.  Afraid I'm still getting the same error after following those instructions.

I'm using separate databases for civi and drupal, but I've confirmed that civicrm.settings.php has the correct database usernames and passwords.

I can't check the mail user's password in the drupal database because it's hashed, but at least the username and e-mail address are correct, and, of course, I've checked that I can log in to drupal with those details.

I looked in civicrm/CRM/Utils/System/Drupal.php, which seems to be where the authenticate script is located, but can't see anything there that jumps out as naturally causing a problem for me.

When I run civimail.cronjob.php from the browser, I get the error "ERROR: Invalid username and/or password ", while, when I run it from the command line, I get the error "ERROR: You need to send a valid user name and password to execute this file".

Clearly, the script is running into the same problem either way, but why does the same script output different errors depending on how you call it?

Would love to solve this problem...

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Scheduled mail not sending - need a valid username and password to execute
October 20, 2011, 06:53:45 pm
Hi 2ways,

Sorry I can't be of much help.
  • Separate databases for Drupal and CiviCRM have no bearing on this issue (your sites would not run if there was a problem w/2 dbs)
  • If you can log in to your website as the CiviCRM mail user, you know the correct credentials
  • Don't know what civicrm/CRM/Utils/System/Drupal.php does
  • the reason you get 2 different errors is because CiviCRM handles a command line request differently from an HTTP request. I do believe the logic is at the bottom of the files that you request EmailProcessor.php and the other one. Starts with "if ( php_sapi_name() == "cli" ) {" so if that is true, it is a command line job (cli = Command line) and if it isn't it rolls into the 'else' which means it is an HTTP job. So the 2 different jobs are handled quite differently, and give different errors.

I'm not a great programmer. I just start jamming echos into the code.
Code: [Select]
echo "I'm in EmailProcessor.php in the function yadda-yadda \n";Run the code, see what pops up. Eventually you find where you need to go.

I also grep for any errors.
Code: [Select]
cd sites/all/modules/civicrm
grep -R "ERROR: Invalid username and/or password" *
You will immediately discover which file is responsible for showing you the error.

cos
« Last Edit: October 20, 2011, 06:57:06 pm by GingerFeet »

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: Scheduled mail not sending - need a valid username and password to execute
October 20, 2011, 06:59:47 pm
Thanks.  Sound advice.

I don't mind the debugging (though not much of a programmer), but the time to do it at the moment is the problem...

Will start 'jamming in echos'!

Lewis

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • Scheduled mail not sending - need a valid username and password to execute

This forum was archived on 2017-11-26.