Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Error on SMTP configuration with Office365

Hello everybody!

I have this error in the SMTP configuration with Office365:

"authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 SMTP server ready)]"

My osTicket version is 1.9.4

Does anyone know how to fix it?

Attached screenshots for reference.

Thank You!

image

image

image
Tagged:

Comments

  • Does your server require TLS?
    Do you actually have POP enabled on the server?
    Have you setup a transport rule to allow the web server to talk to the mail server if memory serves Exchange Management Console -> Server Configuration -> Hub Transport -> Receive Connector?
  • Hi!

    Thanks for the quick response!

    Yes, the server require TLS.
    Yes, actually have POP enabled and working.
    My e-mail server is on the cloud, with Office365 and the POP/SMTP server is Exchange Online,
    I do not have a microsoft exchange server.

    What I can do?

    I was thinking that maybe do lack an output connector on the configuration of Exchange Online...
  • We are also using Office365 cloud based with our 1.9.4 installation, but we have ours set up IMAP as shown in the attached, and we haven't had any trouble.
    imap-osticket.JPG
    530 x 410 - 50K
  • This looks very similar to http://osticket.com/forum/discussion/80872/smtp-errors-when-using-authentication
    And I think I've finally found a solution.
    I mentioned in one of my posts that I'd had a suspicion something was wrong with the way the pear class is trying to negotiate with the smtp server. 

    The problem seems to be with PEAR:IsError

    I tried to replace

                if (PEAR::isError($result = $this->_socket->enableCrypto(true, STREAM_CRYPTO_METHOD_TLS_CLIENT))) {
                    return $result;
                } elseif ($result !== true) {
                    return PEAR::raiseError('STARTTLS failed');
                }

    with

    //if (PEAR::isError($result = $this->_socket->enableCrypto(true, STREAM_CRYPTO_METHOD_TLS_CLIENT))) {
                if (($result = $this->_socket->enableCrypto(true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) === false) {
                    return $result;
                } elseif ($result !== true) {
                    return PEAR::raiseError('STARTTLS failed');
                }

    and was able to save my SMTP configuration, and send e-mails

    Not sure what to do now, I am reluctant to edit all the other functions manually to get rid of the PEAR::IsError construction. Any ideas why it stops people from saving SMTP configuration?
  • I've pinged the devs to take a look at this thread.
  • blueyeguy:

    I enabled the IMAP + SSL configuration however it kept throwing error SMTP connection to Office 365 ...

    Thanks for responding!

  • mayka:

    I modified the code segment you mention to the file:

    include/pear/Net/SMTP.php

    Modified, let me save my SMTP configuration, however, still I can not send mail, in logs throws me the following error:

    Failed to September sender: user@domain.com [SMTP: Invalid response code Received from server (code: -1, response:)]

    Will you have any idea why this error occur?
  • To ntozier:

    There are a few threads on stackoverflow regarding PEAR::IsError
    Can it have something to do with this?

    http://stackoverflow.com/questions/19248503/non-static-method-peariserror-should-not-be-called-statically

    PS I know the code as I used it does not make any sense as both if and elseif check the same thing but return different stuff, but in the original code it reaches the branch in which it raises the error 'STARTTLS failed', in mine it stops before that (because enableCrypto fails). 

    To Francisco:
    It is too early to change anything, I did this just to play with it. It is not the working code you should be using
  • After spending more time on this, I think all my comments are crap, and do not help to solve the issue at all. There is no way to understand what's happening without any debug info. When I use sendmail (as shown in http://osticket.com/forum/discussion/80872/smtp-errors-when-using-authentication), I can enable debugging, and this is what I get:

    14/12/02 01:12:02 ** Connecting to smtp.server.com:25
    14/12/02 01:12:02 ** Connected.
    14/12/02 01:12:02 << 220 smtp.server.com Microsoft ESMTP MAIL Service ready at Tue, 2 Dec 2014 01:12:01 +0000<EOL>
    14/12/02 01:12:02 >> EHLO localhost.domain.com<EOL>
    14/12/02 01:12:02 << 250-smtp.server.com Hello [xx.xxx.xxx.xxx]<EOL>250-SIZE 52428800<EOL>250-PIPELINING<EOL>250-DSN<EOL>250-ENHANCEDSTATUSCODES<EOL>250-STARTTLS<EOL>250-AUTH GSSAPI NTLM<EOL>250-8BITMIME<EOL>250-BINARYMIME<EOL>250 CHUNKING<EOL>
    14/12/02 01:12:02 ** Authenticating as user@domain.com
    14/12/02 01:12:02 >> STARTTLS<EOL>
    14/12/02 01:12:02 << 220 2.0.0 SMTP server ready<EOL>
    14/12/02 01:12:03 >> EHLO localhost.domain.com<EOL>
    14/12/02 01:12:03 << 250-smtp.server.com Hello [xx.xxx.xxx.xxx]<EOL>250-SIZE 52428800<EOL>250-PIPELINING<EOL>250-DSN<EOL>250-ENHANCEDSTATUSCODES<EOL>250-AUTH GSSAPI NTLM LOGIN<EOL>250-8BITMIME<EOL>250-BINARYMIME<EOL>250 CHUNKING<EOL>
    14/12/02 01:12:03 >> AUTH LOGIN<EOL>
    14/12/02 01:12:03 << 334 some base-64 data<EOL>
    14/12/02 01:12:03 >> more data<EOL>
    14/12/02 01:12:03 << 334 data<EOL>
    14/12/02 01:12:03 >> data<EOL>
    14/12/02 01:12:03 << 235 2.7.0 Authentication successful<EOL>
    14/12/02 01:12:03 >> MAIL FROM: <user@domain.com><EOL>
    14/12/02 01:12:03 << 250 2.1.0 Sender OK<EOL>
    14/12/02 01:12:03 >> RCPT TO: <maya.vybornykh@gmail.com><EOL>
    14/12/02 01:12:03 << 250 2.1.5 Recipient OK<EOL>

    The code in the SMTP.php seems to be doing the same, except that I am not quite sure why enableCrypto() fails, and what sendmail does to enable encryption, and whether it is needed at all.
    What I am trying to say is that the SMTP server is configured all right and works if sending e-mails using sendmail, and does not if using Net_SMTP. I am back to using sendmail :(

  • Hello mayka!

    That's right, modifying code or tuning the SMTP PEAR class can not be accomplished without debug info...

    I tried using sendmail as you suggested it via private message, however the detalle of the single sender is a real problem when you have different departements...

    So I started researching a bit on some software to help me and found a EMailRelay:

    http://emailrelay.sourceforge.net/

    With this software you can configure multiple instances and therefore multiple accounts of Office 365, where local servers have different TCP port and they do not require authentication ... that way you can set up POP or IMAP accounts to Office 365 and on the SMTP settings put your local address without authentication ... and have different departments with different email accounts!

    Thank you very much for your help!

    Greetings!
  • I too am having this same problem. I refuses to connect. With the on prem version of exchange I had no issues but Office 365 refuses to connect. I went to install this http://emailrelay.sourceforge.net/ and there seams to be no IMAP option only POP3 and SMTP. I need to be able to have OSTICKET DELETE the email after it processes it and I cant do this without IMAP. I need this middleware application to ace just as if I am connecting to the email  box directly. 

    Is there anything OSTICKET can do to fix/force this to work normally this please????
  • I have same problem on my office 365 set-up.. Any possible solution up to now with using 3rd party software? 
  • Did any find the solution?, We just recently shifted to office 365 and in email configuration, I have having the same error...authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 SMTP server ready)]
  • downgrade to php5.5 will solve issue. php5.6 is absolute shit with email related tasks.

    apt-get purge php* (debian systems)

    how to install php5.5
Sign In or Register to comment.