KevinTheJedi

Hi,

Thanks for this reply.

Nothing seems to be different with our existing email server. All POP/IMAP ports on the email server should be working as we are currently running a 1.14 OSTicket install and it is connecting to this server and even the specific mailbox properly.

We have quickly tested the issue to be related to 1.17:
Steps:
Install Windows, MySQL and WAMP on a VM
Installed OSTicket 1.16
Tried to setup the problematic email / on the email server - no problem

Install Windows, MySQL and WAMP on another VM with the requisite versions
Installed OSTicket 1.17
Tried to setup the problematic email / on the email server - running into a problem

Is there any log we could extract to see where the issue may be?

Thank you!

fsockopen() throws an E_WARNING if hostname is not a valid domain.
So you can put an @ before fsockopen in /include/laminas-mail/src/Protocol/Pop3.php Line 96
or you can catch the exception in the constructor of the class Pop3MailboxProtocol in /include/class.mail.php on Line ~ 328 (try and catch)
A possible food for thought...

I can't save POP3 settings, too.
I have created a new pull request, because there is an error on checking POP3 credentials.
https://github.com/osTicket/osTicket/pull/6297
Maybe it helps you...

    We have the same problem, basic auth works for 1.15.x but NOT 1.17. We had troubles getting Oauth2 working (which we received some notes on how to fix and will try again).. but since basic auth was not working we rolled back to our previous version.

    I think there is an issue with basic auth and m365 IMAP, it works fine when we roll back.

      5 days later

      I have the same problem. I tried the fixes from jens_E but it didn't work out. Nothing changes. Also the @ in front of
      After upgrading to 1.17 the remote mail adresses where disabled. I can't reenable them, because of the error from Post #1
      I made the big mistake already deleted the db backup. Are there any changes? Can I just upload osticket files from 1.16 again or are there bigger changes in the db?

      I've tried Upgrade to actual git. Problem still present

      I have now seen this error by a client of me. He had the same error by using a local ip address. It seems fsockopen can't connect to the server using ssl, if the certificate can't verified.
      To fix this error, the connection should be made with stream_socket_client().

      KevinTheJedi Can we made fixes in the folder ./include/laminas-mail/src/ ? I think this folder don't belongs to the laminas-mail framework. Is this right?
      I would change it to stream_socket_client() and create a pull request, if we can made changes in this folder...

      In this folder, some files have errors, too. So I would fix these errors too...

        jens_E

        You’d have to submit these changes to laminas-mail directly. Anything in include/laminas-mail is 3rd party files.

        Cheers.

          jens_E

          Now that you mentioned it, this may be our issue as well.

          We are also trying to connect to our server with a local IP and we can't get the host certified since the IP address isn't visible on the web nor do we have a dedicated public domain to assign to it.

          Okay, I will write a solution, who needs to solve this error now. This solution will only nessesary, if the connection uses SSL...
          For POP3 connections:
          Go to file /include/laminas-mail/src/Protocol/Pop3.php to Line 96 and replace
          $this->socket = fsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION);
          with
          $context = stream_context_create([
          'ssl' => [
          'verify_peer' => false,
          'verify_peer_name' => false
          ]
          ]);
          $this->socket = stream_socket_client($host.':'.$port, $errno, $errstr, self::TIMEOUT_CONNECTION, STREAM_CLIENT_CONNECT, $context);

          For IMAP4 connections, you find the same code in:
          /include/laminas-mail/src/Protocol/Imap.php in Line 91
          There you find the same code to replace...

          I hope this changes are useful for someone.
          It's not an official solution, but it works.

          Unfortunately this does not work for us. After replacing Line 91 in Imap.php we can save/activate E-Mail without error but than nothing happens. Mails arent fetched... :/

          A quick solution would be great....

          I wanted to make a request to laminas-mail directly, but I saw, the latest version of laminas-mail solves this error.
          laminas-mail 2.18.0 connect to mail servers with stream_socket_client(), not using fsockopen(). So there is a solution to disable certificate validation.
          KevinTheJedi
          I made a pull request to update laminas-mail to 2.18.0 and disabled the validation. Please see at:
          https://github.com/osTicket/osTicket/pull/6312
          There is already a pull request to update laminas-mail, but I removed all development dependencies.
          So laminas-mail includes less than 500 files by using 3,5 MB...
          laminas-mail should not have more files as osTicket itself.
          Please merge this request for the next release.

            KevinTheJedi
            Hi,

            We are confirming that the above change proposed by jens_E is also working for us.

            Realized that this thread is apparently covering two separate issues. :]

            Thank you!

              Hi sushpep

              are you using IMAP? What did you canged? Line 91 in Imap.php?

              We've tried but does not work for us.

              Without change we get:

              And if we change as jens_E described the is no error shown but mails aren't fetched.

              Regards!

                And your cronJob is enabled?
                You can set your log level to debug in Settings->System.
                Then you can see, if the cron runs in your system log. There should be an entry for it...

                  jens_E

                  Hmmmm....
                  Looks like i run into another issue:
                  If i start the job manually i get:

                  ###############
                  /home/ticketing/public_html/api/cron.php
                  PHP Fatal error: Abstract function osTicket\Mail\MailBoxProtocolTrait::oauth2Auth() cannot be declared private in /home/ticketing/public_html/include/class.mail.php on line 238
                  ###############