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 »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • debugging "Test smtp works but registration email does not authenticate"
Pages: [1] 2

Author Topic: debugging "Test smtp works but registration email does not authenticate"  (Read 3337 times)

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
debugging "Test smtp works but registration email does not authenticate"
January 23, 2012, 07:02:18 pm
I need some clues on debugging (I have been spending an insane amount of time trying to debug topic 23069.0)

I would love to be able to sit at the server and see either (a) a Windows MessageBox or (b) a javascript alert pop up,
but neither of those seems to be on php's agenda (I know there is a Win32API interface in php, but I am trying not to
go there).  I know there are some php debugging packages available, but I am trying to avoid those also. So I think that
leaves me with trying to stick text into the HTML returned to the client, but this has issues also.

Specifically, the CiviEvent e-mail configuration work seems to be done in ... Core/config.php, whose getmailer function returns
a reference to generated by Mail::factory. But, config.php returns no HTML, so I tried the
following insertion into the "send" function of ...CRM/Utils/mail.php

$message =
   '<p>' . ts ('myerror stuff') . ':'
   . ts($mailingInfo['smtpServer']) . ':'
   . ts($mailingInfo['smtpPort']) . ':'
   . ts($mailingInfo['smtpUsername']) . ':'
   . ts(CRM_Utils_Crypt::decrypt( $mailingInfo['smtpPassword'])) . ':'
   . ts($_SERVER['SERVER_NAME']) . ':'
    . ts($headers['From']). ':'
    . ts($headers['Reply-To']) . '</p>' ;

Unfortunately $headers is local to another function of mail.php, and $mailingInfo is probably
a public static somewhere (can't spot it, I suppose I could search the codebase for "public $mailingInfo), if
not it is probably a private static somewhere else (I have a guess). 

So my questions are "does everybody go through this? is there an easier way?

Jonathan

PS - I am now thinking that I need to get down into the function generated by Mail:factory to see the difference between
the call that works and the one that fails.  How do I do this????

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: debugging "Test smtp works but registration email does not authenticate"
January 23, 2012, 07:40:59 pm

not sure why u started a new topic but it helps to continue on one topic, IMO

I would enable mail logging to a disk and see the difference in headers between the two emails. Most likely there is a difference since the error message is coming back from the mail server

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

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 24, 2012, 11:49:38 am
So this raises even more questions. 

Here is what I did.  I followed the instructions at http://wiki.civicrm.org/confluence/display/CRMDOC40/Debugging and set the debugging switch and added define('CIVICRM_MAIL_LOG', 1) to the config.settings.php files in both <sitename>/administrator and <sitename>/components.  There was probably some other step you meant me to take, but I could not find it. 

The results were interesting, but somewhat useless
1) the SMTP test worked
2) the REGISTRATION E-MAIL WORKED

I turned off the debugging switch and the registration e-mail still worked.

Then I removed the "defines" and the registration e-mails went back to failing. 

Suggestions?

Jonathan

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: debugging "Test smtp works but registration email does not authenticate"
January 24, 2012, 12:17:05 pm

when logging is enabled, it will ALWAYS work :) because it only logs the email and does not contact the smtp server

once u have logged it, compare the two emails closely especially the headers between what worked with the smtp server and what did not.

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

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 24, 2012, 03:42:51 pm
I should have remembered reading that logging shut off actually sending the e-mail.

I have attached a file with the successful and failing results - I cannot see any differences that suggest any setting that could be mended in the CiviCRM user interface. 

Is there a more detailed trace available in CiviCRM? Is there anyway to inspect the inputs in the $header array passed into the
mailing function. 

Jonathan

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: debugging "Test smtp works but registration email does not authenticate"
January 24, 2012, 04:44:22 pm

if you examine the headers a bit more closely, u'll see that the return path is not set in the smtp test. that might be the cause for the mail server rejecting it

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

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 24, 2012, 07:28:28 pm
Actually return-path was not set in the successful SMTP test, but was set in the failing registration acknowledgement

I modified <sitename>/administrator.....Utils/Mail.php to not transmit Return-Path, Reply-To, or the Auto-Generated fields, and it still fails. 

Results (the one successful SMTP test and the two failing registration acknowledgements) in the attached.

Jonathan

PS Just noticed that the successful test has two "TO:" fields - do not know what to make of that ....

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 25, 2012, 01:33:36 pm
Went and turned on a packet sniffer, so I could we what was acutally going out on the wire. 

The SMTP test sends the correct password

The password sent during registration confirmation is gibberish.

Any of this sound familiar?

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: debugging "Test smtp works but registration email does not authenticate"
January 25, 2012, 03:12:27 pm

no, that is very strange indeed. great debugging technique :)

for the event registration page, i'd just add some debug statements in the mailer code and find out why its sending a bad password

CRM_Core_Config::getMailer( );

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

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 25, 2012, 07:32:19 pm
This is a bear -

I am fairly convinced that the glitch is in the native PHP piece - all of the PEAR wrapper and higher level stuff does not deal with the message-by-message communication with the remote mail server. 

My current take on the conditions required to trigger this problem is
a) a mail server using extended-SMTP (and hence probably port 587 and almost certainly the TLS (transport layer security) exchange
b) a mail server which offers AUTH LOGIN and AUTH PLAIN (for which php selects AUTH LOGIN)
c) handing php an e-mail with "Content-Transfer-Encoding" set in the headers or detected in the message body!?

That last part is speculation on my part - Mail_mime::setMimeParams is working awfully hard at keeping that in, and I have yet to beat it down ...  Further hacks await tomorrow

BUT BY-THE-WAY - is there any better way to do debugging than by inserting the following at points of interest:

CRM_Core_Error::Fatal ( ts('Some text "%1%",array(1 => ?someInterestingVariable)));

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: debugging "Test smtp works but registration email does not authenticate"
January 26, 2012, 11:29:01 am

I typically use a combination of

CRM_Core_Error::debug
print_r
CRM_Core_Error::debug_var // logs to a file
CRM_Core_Error::backtrace

i avoid using fatal since that halts things at that spot

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

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 26, 2012, 05:53:01 pm
I have had no luck isolating the issue to values of data associated with the mail message.  Blown through several hours trying to do so.

So either (a) I am misunderstanding the flow through the (dozen or so - I am guessing - layers) that the message passes through, and/or (b) there is some global context/data value that is affecting the processing. 

In either case - two questions
a) is there any write-up on the interrelationships of PHP mail support, PEAR and the CiviCRM mail classes - there are several thousand lines of code involved and the flow jumps up and down in the hierarchy
b) do you have any experience with debugging packages (e.g. XDebug) with JOOMLA/CiviCrM?

Thanks
Jonathan



JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 27, 2012, 05:15:51 pm
Okay, so I mostly see what is going on -

Somehow, I have managed to foul up  the encryption/decryption in the system.  The "Save and Send Test" thing grabs the e-mail password from the input screen and so does not go through decryption.  Registration confirmation e-mails pull up the encrypted password and decrypts it. (unsuccessfully on my system)  Resaving the password does not cure the problem, so something that mcrypt relies on is broken. 

Is there a way to reset the encryption elements (otherwise I guess I will have to try rebuilding/cloning). 

Jonathan

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: debugging "Test smtp works but registration email does not authenticate"
January 27, 2012, 06:30:14 pm

make sure your CIVICRM_SITE_KEY has the same value for both the front end and back end. i.e. in the files:

components/com_civicrm/civicrm.settings.php
administrator/components/com_civicrm/civicrm.settings.php

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

JonWex

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 3.4.8
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.5.8
  • PHP version: 5.3.3
Re: debugging "Test smtp works but registration email does not authenticate"
January 28, 2012, 08:18:49 am
Don -

Yes, that was it.  Thanks for all your help. 

It was a learning experience.  Should have sorted this out hours ago, but glitches are easy to see in the rear view mirror. 

Thanks again. 

Jonathan


Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • debugging "Test smtp works but registration email does not authenticate"

This forum was archived on 2017-11-26.