Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection setup failed #4079

Closed
Gawrisch opened this issue Jun 17, 2024 · 17 comments
Closed

connection setup failed #4079

Gawrisch opened this issue Jun 17, 2024 · 17 comments

Comments

@Gawrisch
Copy link

Hello,

we are using freescout with 5 Mailboxes.
From one day to another on a one mailbox when checking the settings, he says "connection setup failed".
Nothing has changed with the configuration.
Any clue how I could fix this ?

PHP version:
FreeScout version: 7.8.33
Database: MySQL
Are you using CloudFlare: No
Are you using non-official modules: No

@freescout-help
Copy link
Collaborator

Does it happen all the time or from time to time?

@Gawrisch
Copy link
Author

unfortunately the error exists since more than one week.

@freescout-help
Copy link
Collaborator

@Gawrisch
Copy link
Author

Gawrisch commented Jun 17, 2024

Following error-message in the logs.
We are not using M365. We are using Exchange on prem. All other accounts work.

Checked the troubleshooting-fetching FAQ, but still :

Date | Event | Error | Mailbox -- | -- | -- | -- Juni 17, 15:35:02 | Fehler beim Empfangen der E-Mail | Error: connection setup failed; File: /www/html/vendor/webklex/php-imap/src/Client.php (391) | Calenso HelpDesk

@freescout-help
Copy link
Collaborator

Did it work before?

The only way to investigate it is for someone to check on your server or you can create a temporary mail account and send to support@freescout.net

@Gawrisch
Copy link
Author

Yes, it worked since February and without any change it stopped working. I checked again all Exchange settings.

@freescout-help
Copy link
Collaborator

Try to change lines 366-370 in /vendor/webklex/php-imap/src/Client.php to:

        } catch (ErrorException $e) {
            throw new ConnectionFailedException("connection setup failed - ".$e->getMessage(), 0, $e);
        } catch (Exceptions\RuntimeException $e) {
            throw new ConnectionFailedException("connection setup failed - ".$e->getMessage(), 0, $e);
        }

After that try to fetch emails again and you should get more detailed error message (post it here).

@freescout-help
Copy link
Collaborator

Here is the updated /vendor/webklex/php-imap/src/Client.php file, try it to get more detailed error messages:
Client.zip

@Gawrisch
Copy link
Author

Which one of these ?

/assets/install/vendor/symfony/http-kernel/Client.php
/assets/install/vendor/webklex/php-imap/src/Client.php
/assets/install/vendor/webklex/laravel-imap/src/IMAP/Facades/Client.php
/assets/install/overrides/webklex/laravel-imap/src/IMAP/Client.php
/assets/install/overrides/guzzlehttp/guzzle/src/Client.php
/www/html/vendor/symfony/http-kernel/Client.php
/www/html/vendor/webklex/php-imap/src/Client.php
/www/html/vendor/webklex/laravel-imap/src/IMAP/Facades/Client.php
/www/html/overrides/webklex/laravel-imap/src/IMAP/Client.php
/www/html/overrides/guzzlehttp/guzzle/src/Client.php

@freescout-help
Copy link
Collaborator

freescout-help commented Jun 18, 2024

/www/html/vendor/webklex/php-imap/src/Client.php

Or you can simply update FreeScout to the latest version. It has already been published.

@Gawrisch
Copy link
Author

This made my troubleshooting much better. We deleted the account from our exchange server and re-added it. Now it works !
Great support ! Thank you so much.

@freescout-help
Copy link
Collaborator

Great. So what was the error message and what was the problem?

@Gawrisch
Copy link
Author

The error message was : Error: connection setup failed: Authentication failed; File: /www/html/vendor/webklex/php-imap/src/Client.php (391)

so I thought : if he is not able to authenticate and all other accounts have the same settings and work, it has something to do with the exchange-account. So, I deleted the user and account and re-added it. Workes as charm. Microsoft is doing strange things sometimes. :-)

@jimmie-jam
Copy link

I am having this exact same issue, but on a brand new instance of Freescout. I have never been able to get email fetching to work. The error is identical. I've tried a couple of different admin emails (admin emails that manage MS365). But nothing seems to work. all I see is this:
Error: connection setup failed: Authentication failed; File: /www/html/vendor/webklex/php-imap/src/Client.php (391)

which is pretty cryptic. I don't know. If all else works and IMAP and SMTP are allowed already on my chosen user email acccount, I am at a loss.

@freescout-help
Copy link
Collaborator

@jimmie-jam
Copy link

@jimmie-jam For MS365 you need to use modern oAuth IMAP authentication: https://github.com/freescout-help-desk/freescout/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-oAuth

Thank you. My biggest issue with this is I don't know the location of the .env file to add the oAuth parameter, or enable debug to troubleshoot. I have asked for that location on another thread, but no one is answering that question.

@freescout-help
Copy link
Collaborator

There is no such thing as oAuth parameter in .env file. Simply follow the instruction above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants