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 »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • smtp auth
Pages: [1]

Author Topic: smtp auth  (Read 2594 times)

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
smtp auth
March 17, 2009, 04:15:08 pm
Hello everyone,

I am struggling with an issue with civicrm (1.9 with kabissa custom module) sending mail, and would be grateful for any insights. I migrated to a new server last week (mediatemple d/v) and it works great. Drupal has no problems sending mail. However, it seems I am unable to get the civicrm SMTP server settings to work on the new server, and anytime my civi system needs to send out an email it gives an ugly error message to the user. The server name, username and password all work in an email client.

Apache and drupal logs are not showing anything meaningful.

With debugging and backtrace turned on, I get the error below.

I am at wits end today and would like to get this resolved before I leave tonight on a trip. Thanks for any help! 

Tobias

First at the top -
Code: [Select]
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 148
, handle,
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 901
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/PEAR.php, PEAR_Error, 566
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Net/SMTP.php, raiseError, 274
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Net/SMTP.php, _parseResponse, 560
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Net/SMTP.php, _authCRAM_MD5, 455
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Mail/smtp.php, auth, 244
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Utils/Mail.php, send, 153
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/kabissa/CRM/Kabissa/Form/Application/View.php, send, 227
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/StateMachine.php, postProcess, 166
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php, perform, 63
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 195
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 95
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 220
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/kabissa/CRM/Kabissa/Invoke.php, run, 121
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Component.php(206) : eval()'d code, main, 1
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Component.php, eval, 206
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php, invoke, 144
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 320
, civicrm_invoke,
/var/www/vhosts/kabissa.org/httpdocs/includes/menu.inc, call_user_func_array, 418
/var/www/vhosts/kabissa.org/httpdocs/index.php, menu_execute_active_handler, 15
...then inside the page...
Code: [Select]
     Sorry. A non-recoverable error has occurred.

    Return to home page.

Error Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] =>
    [message] => Authentication failed.
    [mode] => 16
    [debug_info] =>
    [type] => PEAR_Error
    [user_info] =>
    [to_string] => [pear_error: message="Authentication failed." code=0 mode=callback callback=CRM_Core_Error::handle prefix="" info=""]
)
...and then the following at the bottom of the page.
Code: [Select]
backTrace

/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 148
, handle,
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 901
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/PEAR.php, PEAR_Error, 566
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Net/Socket.php, raiseError, 290
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Net/SMTP.php, write, 169
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Net/SMTP.php, _send, 204
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Net/SMTP.php, _put, 337
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Mail/smtp.php, disconnect, 322
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Mail/smtp.php, disconnect, 177
, _Mail_smtp,
[/code]
Kabissa - Space for Change in Africa http://kabissa.org

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: smtp auth
March 17, 2009, 08:06:44 pm
I hope I can help you, I will try!  I have struggled with SMTP errors myself.  The SMTP function uses a PHP extension called "PEAR" which is included in the CiviCRM install.   It appears that PEAR is not authenticating as I see in this here, but maybe not for the reason you think!

Code: [Select]
pear_error: message="Authentication failed."

I'm going to assume that you have checked that your SMTP:
  • mailserver setting (for instance mail.mysite.com)
  • mail user (for instance mymail+mysite.com)
  • password
...are all set correctly?  Double check in a mail client like Thunderbird or Outlook Express first.

Ok, now assuming you've gotten that far and PEAR SMTP is still not authenticating, you're going to have to look at your system email settings. 

1. I'm not familiar with version 1.9, so just find out where you set your "Domain Settings" in the CiviCRM Administration and set that all email addresses to the same email as your outgoing SMTP account email.

2. Then go to (if it exists in 1.9) "From Emails" and add a from email, if it doesn't already exist, and set that to the same email address as the Domain Settings and your SMTP account email.

3. Then finally go and set your drupal admin user account that you yourself are logged into the system and set your user account email to the same email address.

4. So to review, your Drupal user account, SMTP outgoing server settings, custom "From address" and your "Domain Settings" email should all be the exact same email address.  Now run the test for SMTP server settings again through CiviCRM.

If THAT doesn't work then try to test that PEAR email works at all on your webhost.

This is a sample script, make sure to fill in your settings appropriately for email username and password, then upload this as a .php file called "smtptesting.php" or something to your public_html (web root) directory.

Your path to PEAR mail appears to be either here:
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/
or here:
/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/CRM/Utils/

Code: [Select]
<?php

require_once "<<path to PEAR Mail.php>>Mail.php";

$from ="you <you@yoursite.com>";

// try some different email recipients here?
$to = "you <you@yoursite.com>";

$subject = "Hi - smtp t3sst sending!";
$body = "Hi,\n\nHow are smtp thing working you?";

$host = "mail.yoursite.com";
$username = "yourmail+yoursite.com";
$password = "passwordhere";

$headers = array ('From' => $from,
  
'To' => $to,
  
'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array (
'host' => $host,
    
'auth' => true,
    
'username' => $username,
    
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (
PEAR::isError($mail)) {
  echo(
"<p>" . $mail->getMessage() . "</p>");
 } else {
  echo(
"<p>Message successfully sent!</p>");
 }
?>


And if that smtptesting.php page doesn't work when you bring it up in a browser like so: www.yoursite.com/smtptesting.php it means PEAR isn't installed right on your server or there is some kind of hosting restriction.

Good luck!
« Last Edit: March 17, 2009, 08:10:49 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: smtp auth
March 18, 2009, 09:15:10 am
Thanks so much for your help! I think I may be further along. I made it all the way through your instructions - and I continue to get the same error.

Your script produces the error below - does this help at all?

Cheers,

Tobias

Code: [Select]
Warning: Mail_smtp::include_once(Net/SMTP.php) [mail-smtp.include-once]: failed to open stream: No such file or directory in /var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Mail/smtp.php on line 212

Warning: Mail_smtp::include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:') in /var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Mail/smtp.php on line 212

Fatal error: Class 'Net_SMTP' not found in /var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/packages/Mail/smtp.php on line 216
Kabissa - Space for Change in Africa http://kabissa.org

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: smtp auth
March 18, 2009, 12:12:58 pm
Oh ok, your PEAR Mail extension is in the wrong place, and efforts of one PEAR File to include another PEAR File are failing.  This really confused me at first when I ran into this problem.   These errors are not a failure for SMTP to validate, it's a failure of PEAR to find the files to make itself work.

#1 Option:  Your php.ini file has an "include_path" in it, where all PHP extensions are looked for by PHP.  Your PEAR Mail extension must be installed in this directory.  To find out where your include path is use phpinfo(); on a PHP page and look for include_path and copy your PEAR Mail files there

#2 Option: within PHP script itself set_include_path() http://us.php.net/set_include_path

#3 Option: one at a time, handle the "failed to open stream" errors by copying the required files into the directory the script is looking for.  This will result in a lot of duplication of files but it will eventually work.  It's messy, try to go with #1 and #2 first.


Try CiviTeacher: the online video tutorial CiviCRM learning library.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: smtp auth
March 18, 2009, 02:47:03 pm
hi Stoob -

Getting closer! I am still struggling through because when I do #1 the civicrm module does not load and I get this error message:

Code: [Select]
Oops! - The path for including CiviCRM code files is not set properly. Most likely there is an error in the civicrm_root setting in your CiviCRM settings file (sites/kabissa.org/civicrm.settings.php).

» civicrm_root is currently set to: /var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm/.

Please review the Installation Instructions, Installation FAQs, and Trouble-shooting documentation for assistance.

Seems like I've got some other things wrong. I will keep troubleshooting.

-T
Kabissa - Space for Change in Africa http://kabissa.org

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: smtp auth
March 18, 2009, 04:10:14 pm
You are not to change the  root in your civicrm.settings.php file.

Copy the PEAR Mail .php files to your php.ini include_path.  This should have no effect on your CiviCRM code path
Try CiviTeacher: the online video tutorial CiviCRM learning library.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: smtp auth
March 20, 2009, 01:09:37 pm
Hi Stoob -

Thanks for your perservering in trying to help me. I did not change the root in my civicrm.settings.php file, but made sure the PEAR Mail files are in the include_path.

I had a php programmer spend a few hours also trying to fix the problem, but he didn't get civicrm working either although he did succeed in getting your test script working.

I'm basically at the end of the road here and remain stuck - there probably is some configuration error, either after the migration of civi to a new host, or to do with mediatemple's specific setup.

Cheers,

Tobias
Kabissa - Space for Change in Africa http://kabissa.org

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
FIXED! Re: smtp auth
March 20, 2009, 07:45:09 pm
Hi,

I finally fixed my problem after many days of struggle. The problem revealed itself when I followed the instructions on this page to turn on the Smarty Debug Window:

Quote
Smarty Debug Window - Loads all variables available to the current page template into a pop-up
window. To trigger, add '&smartyDebug=1' to any CiviCRM URL query string.

It turns out that civicrm for some unknown reason was using the SMTP password we used to use on the old server, and not the new one. The password set in the civicrm.settings.php file is being ignored. Any ideas why this might be happening?

Thanks for the help,

Tobias
Kabissa - Space for Change in Africa http://kabissa.org

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: smtp auth
March 20, 2009, 08:56:15 pm

The smtp settings for 1.9 are stored in the DB and not in civicrm.settings.php. the url is of the form:

http://drupal.demo.civicrm.org/civicrm/admin/setting/smtp?reset=1

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

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: smtp auth
March 20, 2009, 09:15:48 pm
Hi Lobo,

In 1.9 (on my system) only the server and username is configured at the URL you provided (see attached screenshot). The password is (or used to be) stored in civicrm.settings.php. I changed this when I moved to Media Temple, but civicrm ignored the change in the settings.

I'm not sure what's going on, but in any case I think I'm good to go for the moment - thanks for the input.

Cheers,

Tobias
Kabissa - Space for Change in Africa http://kabissa.org

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • smtp auth

This forum was archived on 2017-11-26.