Page 1 of 1

Authentication failing??

Posted: Thu Jan 17, 2008 10:25 pm
by alex.barylski
I have the following simple code:

Code: Select all

$smtp = new Swift_Connection_SMTP('isp.blah.net');
$smtp->setUsername('test');
$smtp->setPassword('test');
 
$swift = new Swift($smtp);
Using the exact same credentials I was able to login to my account using Outlook on my Windows machine but when I try the above code in PHP on my Linux box...I get an 'connection exception'.

Any ideas as to what might be causing this? I've read your docs and I'm thinking maybe it's the password validation using MD5 when my SMTP mail server may not support that. I have nothing special configured in Outlook which would make me think this...

Both my desktop and linux server sit side by side behind the same routuer...yet the credentials work under Outlook. I'm confused, any advice?

Edit: I have tried the following code using my GMail account:

Code: Select all

$smtp = new Swift_Connection_SMTP("smtp.gmail.com", Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS);
$smtp->setUsername("myname@gmail.com");
$smtp->setpassword("mypass");
This seems to work as I don't get any exceptions about connection issues. I am bewildered, as I've tried playing with the parameters in the Swift_Connection_SMTP constructor but sitll get nothing. The connection works fine when used from Outlook on my desktop. They both sit behind the same router...so I don't think it's a port issue...

Although I got my code working...I would still like any opinions anyone has on why this might happen???

Cheers :)

Re: Authentication failing??

Posted: Fri Jan 18, 2008 12:02 am
by Chris Corbyn
Are you connecting to an Exchange server or just a standard SMTP server? Exchange often tries to do NTLM authentication which Swift doesn't currently support. Someone once sent me an authenticator for it though I've no way of testing it.

Re: Authentication failing??

Posted: Fri Jan 18, 2008 10:27 am
by alex.barylski
Chris Corbyn wrote:Are you connecting to an Exchange server or just a standard SMTP server? Exchange often tries to do NTLM authentication which Swift doesn't currently support. Someone once sent me an authenticator for it though I've no way of testing it.
I think I'm connecting to just a plain jane SMTP server: shawmail.wp.shawcable.net

I don't need any special configuration to get my Outlook Express...just plug in the SMTP, User, Pass and voila!!! No exchange servers locally installed...

Any other ideas? I'm curious as to why I wouldn't be able to connect to the SMTP server on my Windows but not my Linux machine...

Re: Authentication failing??

Posted: Fri Jan 18, 2008 5:11 pm
by Chris Corbyn
I'm not sure without seeing a little more detail. I can't connect to that server since it just drops my TCP packets.

If you'd care to send me a log dump (private message it please since it's potentially sensitive data) then I'll have a clearer picture of what the server's doing.

NOTE: Unless CRAM-MD5 is attempted, your passwords will be in a format which can be read (plan or base64), it's probably best to remove any base64 before PM'ing me ;)

Code: Select all

$log = Swift_LogContainer::getLog();
$log->setLogLevel(Swift_Log::LOG_EVERYTHING);
 
try
{
  /*** All the code you had goes here ***/
}
catch (Exception $e)
{
  //ignored
}
 
echo '<pre>' . $log->dump(1) . '</pre>';