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

Failed to configure Email SMTP settings

Hi, when i using admin to configure email smtp setting, it came out authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 Ready to start TLS)] error message.

Please kindly advice me how should i do this ?

Comments

  • What server software is your mail server?
    And what does the rest of your setup look like?
  • Hi, I had the same problem ... as I'll explain:

    My problem was that the blocking server connections using TLS

    walking in the \ include \ pear \ Net, I found the file smtp.php

    modify the line 467

    the line is something like:
    if (version_compare (PHP_VERSION, '5 .1.0 ','>=') & & (isset ($ this-> _esmtp [' STARTTLS ']) | | ($ this-> _esmtp [' STARTTLS '] == true)) ) {

    replaced it with:
    if (version_compare (PHP_VERSION, '6 .1.0 ','>=') & & (isset ($ this-> _esmtp [' STARTTLS ']) | | ($ this-> _esmtp [' STARTTLS '] == true)) ) {

    I guess what I got was that they connect to SMTP using TLS because that line it does is connect using TLS if the version of PHP is 5.1.0 and my version was that actually .. so I put the 6.1.0 (which does not exist) and so connected without using TLS and since then I accept the accounts and everything works perfect. :)

    I hope to thee:)

    Greetings.
  • Thanks matuha suggestion, it's work for me too
  • Just install php5-openssl and it will work without changing smtp.php.

    Chris
  • matuha;17945 said:
    Hi, I had the same problem ... as I'll explain:

    My problem was that the blocking server connections using TLS

    walking in the \ include \ pear \ Net, I found the file smtp.php

    modify the line 467

    the line is something like:
    if (version_compare (PHP_VERSION, '5 .1.0 ','>=') & & (isset ($ this-> _esmtp [' STARTTLS ']) | | ($ this-> _esmtp [' STARTTLS '] == true)) ) {

    replaced it with:
    if (version_compare (PHP_VERSION, '6 .1.0 ','>=') & & (isset ($ this-> _esmtp [' STARTTLS ']) | | ($ this-> _esmtp [' STARTTLS '] == true)) ) {

    I guess what I got was that they connect to SMTP using TLS because that line it does is connect using TLS if the version of PHP is 5.1.0 and my version was that actually .. so I put the 6.1.0 (which does not exist) and so connected without using TLS and since then I accept the accounts and everything works perfect. :)

    I hope to thee:)

    Greetings.

    Thanks verymuch this is wirking vey well
  • Dear All,

    Just share info, I got the same issue when I install osTicket v1.9.3 on CentOS 6.5, I fix the problem try to follow suggestion above.

    But when I tried open /include/pear/Net/SMTP.php with nano editor I found little bit different (could it be because version different) like these :

    line 467 as mention above :

           if (PEAR::isError($error = $this->_parseResponse(220))) {
                return $error;
            }

    seems different.

    I found in line 600 as follows :
            if ($tls && version_compare(PHP_VERSION, '5.1.0', '>=') &&
                extension_loaded('openssl') && isset($this->_esmtp['STARTTLS']) &&
                strncasecmp($this->host, 'ssl://', 6) !== 0)

    I modify to :
            if ($tls && version_compare(PHP_VERSION, '6.1.0', '>=') &&
                extension_loaded('openssl') && isset($this->_esmtp['STARTTLS']) &&
                strncasecmp($this->host, 'ssl://', 6) !== 0)

    And working, has issue no more with SMTP (send email) with authentication required = YES

    Thanks for everyone

  • edited January 2015
    I was getting this error, but even disabling STARTTLS (as several of the above comments suggest) didn't help, as it then reported an authentication error. I found the proper fix for at least my situation.

    If you're using PHP 5.6, there are changes to SSL:

    Mainly, there is extra verification done on the connection. This verification wasn't done on 5.5 so these issues were ignored. But in my situation, the server was sending the SMTP EHLO command with "localhost" and apparently that causes PHP's new verification to fail.

    The solution is to patch osTicket's mail class at /include/pear/Net/SMTP.php - change this line:

    $this->_socket_options =$socket_options;

    to

    $this->_socket_options = array('ssl' => array('verify_peer_name' => false));

    This turns the verification off. For my setup, the mail server is on the same local network as the osTicket server, so I'm not overly concerned about the security.

    The other solution is to downgrade to PHP 5.5 which doesn't have this extra verification.

    It'd be nice if osTicket somehow offered a setting for this so patching the code isn't necessary every time. 
  • I've pinged the devs about this thread.
  • Pardon me if I'm a noob here, but in SSL context, isn't `verify_peer_name` usually used to verify the apparent hostname of a server with the hostname in the server certificate. Are you using a self signed certificate or something?
  • I really dont think that I like the idea that I have to log into google drive to see this file.  Sorry but not going to open that link.
  • Been a while since any new comments were added to this thread. Just wanted to note that the problem still exists as of 2016-11-03 with OSTicket version 1.9.14, and that kainjow's solution fixes it.

    I just looked on OSTicket website, and it seems that version 1.10 addresses the problem, based off the following note in the release notes:

    "PEAR: Turn off peer name verification by default (SMTP) (#3274, 4f68aeb)"

    Haven't tested this though, since the version was released just a few days go; seems based on that comment that the solution was simply to implement what kainjow had posted above.
  • edited November 2016
    Hi,
    i got the same issue on osTicket v1.9.15
    Also the mailserver i try to use doesn't support unsecure connections anymore.

    On Port 465 it takes a long time then it says Failed to connect to smtp.strato.de:465 [SMTP: Invalid response code received from server (code: -1, response: )]
    On port 587 it says authentication failure [SMTP: STARTTLS failed (code: 220, response: Ready to start TLS)]

    i tried matuha's approach to set the value the php version is compared to to 6.1.0, but it failed slightly different.
    (for version 1.9.15 it can be found at line 564 of /include/pear/Net/SMTP.php)

    On Port 465 again it takes a long time and then says Failed to connect to smtp.strato.de:465 [SMTP: Invalid response code received from server (code: -1, response: )]
    On port 587 it says authentication failure [SMTP: Invalid response
    code received from server (code: 538, response: 5.7.11 authentication failed, please try SSL/TLS
    Verschluesselung]

    I also tried experimental Bugfix #2628 by John Hunt committed Feb 17, 2016, but it results in the same messages as with matuha's approach.
  • Hi Guys,

    I know this is an old thread, but I'm having this very same issue on latest version 1.10, MySQL 5.5.43 and PHP 5.6.3.

    If I downgrade to 5.5.9 php version - I can send mail no problem - however that versions presents me with performance issues and error 500.

    I have OpenSSL extension installed and loaded...

    I've tried the suggested edits as proposed above however, I now get this error:

    authentication failure [SMTP: SMTP server does
    not support authentication (code: 250, response: MX-Core.love4it.local
    Hello [46.32.253.24]
    SIZE 36700160
    PIPELINING
    DSN
    ENHANCEDSTATUSCODES
    STARTTLS
    X-ANONYMOUSTLS
    AUTH
    X-EXPS GSSAPI NTLM
    8BITMIME
    BINARYMIME
    CHUNKING
    XRDST)]

    Any help is much appreciated

    Regards,

    Andre
Sign In or Register to comment.