PHP Classes

Issues with Office365 SMTP AUTH recognition

Recommend this page to a friend!

      SMTP E-mail sending class  >  All threads  >  Issues with Office365 SMTP AUTH...  >  (Un) Subscribe thread alerts  
Subject:Issues with Office365 SMTP AUTH...
Summary:Office365 TLS issues
Messages:5
Author:Sachin J
Date:2014-10-14 18:43:25
 

  1. Issues with Office365 SMTP AUTH...   Reply   Report abuse  
Picture of Sachin J Sachin J - 2014-10-14 18:43:25
Hello,

Here is flow for your script
1) Connect to SMTP
2) ELHO
3) Read AUTH mechanisms and store them
4) Try AUTH mechanism
5) Send email etc...

In case of Office 365 above flow does not work as it requires Starttls command after EHLO then only Office365 display its AUTH mechanisms
Due to this your script does not get any mechanisms and thus fails to work further.

Please let me know how we can fix this?




  2. Re: Issues with Office365 SMTP AUTH...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-10-14 22:17:00 - In reply to message 1 from Sachin J
That is what happens here, it starts with a regular EHLO, then STARTTLS and then EHLO again but this time over a cryptographic connection. Isn't that what happens for you?

  3. Re: Issues with Office365 SMTP AUTH...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-10-14 22:31:22 - In reply to message 2 from Manuel Lemos
So you know, I tried to send a delivery with following settings and it went well as expected:

$smtp->host_name="smtp.live.com";
$smtp->host_port=587;
$smtp->ssl=0;
$smtp->start_tls=1;
$smtp->user="someuser@hotmail.com";
$smtp->realm="";
$smtp->password="somepassword";

Resolving SMTP server domain "smtp.live.com"...
Connecting to host address "65.55.176.126" port 587...
Connected to SMTP server "smtp.live.com".
S 220 BLU436-SMTP259.smtp.hotmail.com Microsoft ESMTP MAIL Service, Version: 8.0.9200.16384 ready at Tue, 14 Oct 2014 15:26:01 -0700
C EHLO localhost
S 250-BLU436-SMTP259.smtp.hotmail.com Hello [187.39.26.226]
S 250-TURN
S 250-SIZE 41943040
S 250-ETRN
S 250-PIPELINING
S 250-DSN
S 250-ENHANCEDSTATUSCODES
S 250-8bitmime
S 250-BINARYMIME
S 250-CHUNKING
S 250-VRFY
S 250-TLS
S 250-STARTTLS
S 250 OK
C STARTTLS
S 220 2.0.0 SMTP server ready
Starting TLS cryptograpic protocol
TLS started
C EHLO localhost
S 250-BLU436-SMTP259.smtp.hotmail.com Hello [187.39.26.226]
S 250-TURN
S 250-SIZE 41943040
S 250-ETRN
S 250-PIPELINING
S 250-DSN
S 250-ENHANCEDSTATUSCODES
S 250-8bitmime
S 250-BINARYMIME
S 250-CHUNKING
S 250-VRFY
S 250-AUTH LOGIN PLAIN XOAUTH2
S 250 OK
C AUTH LOGIN
S 334 XXXXXXXXXXXX
C YYYYYYYYYYYYYYYYYYYYYYYYY==
S 334 ZZZZZZZZZZZZ
C WWWWWWWWWWWWWWWW=
S 235 2.7.0 Authentication succeeded
C MAIL FROM:<someuser@hotmail.com>
C RCPT TO:<recipient@gmail.com>
C DATA
S 250 2.1.0 someuser@hotmail.com....Sender OK
S 250 2.1.5 recipient@gmail.com
S 354 Start mail input; end with <CRLF>.<CRLF>
C From: someuser@hotmail.com
To: recipient@gmail.com
Subject: Testing Manuel Lemos' SMTP class
Date: Tue, 14 Oct 2014 19:26:00 BRT


C Hello recipient@gmail.com,

It is just to let you know that your SMTP class is working just fine.

Bye.

C
.
S 250 2.6.0 <BLU436-SMTP259oygXL00019c6b@BLU436-SMTP259.smtp.hotmail.com> Queued mail for delivery
C QUIT
S 221 2.0.0 BLU436-SMTP259.smtp.hotmail.com Service closing transmission channel
Disconnected.
Message sent to recipient@gmail.com OK.

  4. Re: Issues with Office365 SMTP AUTH...   Reply   Report abuse  
Picture of Klemen Klemen - 2014-10-26 15:05:50 - In reply to message 3 from Manuel Lemos
Office365 works fine here too.

Check with your hosting company that port 587 is open on your server! This was many times the issue with my customers having problems.

  5. Re: Issues with Office365 SMTP AUTH...   Reply   Report abuse  
Picture of Klemen Klemen - 2014-10-26 15:07:23 - In reply to message 4 from Klemen
And if you are running PHP 5.6 you may have problems with peer certificate validation:
phpclasses.org/discuss/package/14/t ...