freescout icon indicating copy to clipboard operation
freescout copied to clipboard

Freescout IMAP connection error - SMTP is connecting

Open semaf opened this issue 10 months ago • 1 comments

Hey,

I have an issue with the IMAP connection with type of encryption. SMTP is working fine. It is a local connection between two docker containers in same network.

How is the password forwarded? Plain, crypted? Maybe its the TLS version?

Would be about some help.

If using STARTTLS, the log: Apr 26, 15:30:02 Error fetching email Error: connection failed; File: /www/html/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php (82)

Dovecot log: dovecot-mailcow-1 | dovecot: imap-login: Disconnected: Aborted login by logging out (auth failed, 1 attempts in 3 secs): user=<domain>, method=PLAIN, rip=172.22.1.16, lip=172.22.1.250, TLS, TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)

Using TLS, the log Apr 26, 15:30:02 Error fetching email Error: connection failed; File: /www/html/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php (82)

Dovecot: dovecot-mailcow-1 | dovecot: imap-login: Disconnected: Too many invalid commands (no auth attempts in 0 secs): user=<>, rip=172.22.1.16, lip=172.22.1.250

Using none encryption: Apr 26, 15:34:04 | Error fetching email | Error: connection setup failed; File: /www/html/vendor/webklex/php-imap/src/Client.php (391)

Dovecot: dovecot-mailcow-1 | dovecot: imap-login: Disconnected: Aborted login by logging out (auth failed, 1 attempts in 0 secs): user=<domain>, rip=172.22.1.16, lip=172.22.1.250

semaf avatar Apr 26 '24 15:04 semaf

Try to add APP_NEW_FETCHING_LIBRARY=true parameter to the .env file and clear cache.

freescout-helpdesk avatar May 05 '24 06:05 freescout-helpdesk

I am receiving the same error:

Error fetching email Error: connection failed; File: /www/html/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php (82)

This started today after upgrading from 1.8.139 to 1.8.140

I tried adding the APP_NEW_FETCHING_LIBRARY=true parameter and clearing the cache, however the error persists. I did not change any settings before or after upgrading to 1.8.140.

Any other suggestions?

torrelasley avatar May 17 '24 19:05 torrelasley

I looked over the code changes from 1.8.139 to 1.8.140 and see that APP_NEW_FETCHING_LIBRARY is now defaulted to "true".

torrelasley avatar May 17 '24 19:05 torrelasley

@torrelasley What email service are you using? Can you send the screenshot of your Fetching settings.

In the future the old fetching library will be removed, so better to make sure you are able to fetch via the new library.

Try the following:

  1. Remove APP_NEW_FETCHING_LIBRARY parameter from the .env file.
  2. Clear cache.
  3. Go to your mailbox's "Fetching Emails" settings and try different "Encryption" options:

2024-05-18_07-40-50

After changing Encryption or some other Fetching settings DON'T forget to save settings before checking the connection!

freescout-helpdesk avatar May 18 '24 04:05 freescout-helpdesk

I followed your steps and removed APP_NEW_FETCHING_LIBRARY and cleared the cache.

Switching to STARTTLS worked for my system!

Note that you must click "Save Settings" after making the change before pushing the "Check Connection" button. At first I thought none of the Encryption settings would work until I realized this.

Unfortunately I didn't take a screenshot before I made the change so I don't know how it was previously set. Thank you for your help!

torrelasley avatar May 18 '24 15:05 torrelasley

Had same issue. Set APP_NEW_FETCHING_LIBRARY=true and it's working again.

andyknas avatar May 21 '24 13:05 andyknas

@andyknas In the future the old fetching library will be removed, so better to make sure you are able to fetch via the new library.

After changing Encryption or some other Fetching settings DON'T forget to save settings before checking the connection!

freescout-helpdesk avatar May 21 '24 13:05 freescout-helpdesk

I have tried all of the above suggestions and I am still having issues after upgrading to 1.8.140

I have set APP_NEW_FETCHING_LIBRARY and tried all three encryption options

It worked before I did the upgrade using SSL, using zoho IMAP, port 993, imap.zoho.com.au

Error fetching email | Error: connection failed; File: /www/html/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php (82)

any other things I can try?

bb0x88 avatar May 23 '24 00:05 bb0x88

After changing Encryption or some other Fetching settings DON'T forget to save settings before checking the connection!

@torrelasley @bb0x88 You can create a temporary email for us to check it and send access and connection details to [email protected]

@bb0x88 Are you using personal Zoho mail or Business Zoho mail? We've just checked IMAP connection to the personal Zoho mail and it works fine:

2024-05-23_07-41-35

freescout-helpdesk avatar May 23 '24 04:05 freescout-helpdesk

I'm out of the office for the FedEx Compatible Envision 2024 Conference thru June 11th. Replies to email will be delayed while away.

If you need urgent assistance please email @.*** and someone from our staff will get back to you during normal business hours.

andyknas avatar Jun 11 '24 16:06 andyknas

Also try to disable "Validate Certificate" option.

freescout-help avatar Jun 16 '24 06:06 freescout-help

In /overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php try to change line 82 to:

throw new ConnectionFailedException('connection failed - '.$e->getMessage(), 0, $e);

Try to connect again and you should see more detailed error message.

freescout-help avatar Jun 16 '24 06:06 freescout-help

Try to add APP_NEW_FETCHING_LIBRARY=true parameter to the .env file and clear cache.

Where is the .env file?

jimmie-jam avatar Jun 18 '24 11:06 jimmie-jam

The APP_NEW_FETCHING_LIBRARY=true parameter is outdated and has no effect anymore.

In the latest version of FreeScout fetching errors now became more informative. So in case of any issues see https://github.com/freescout-help-desk/freescout/wiki/Fetching-Emails#troubleshooting-fetching or create a new issue specifying your error.

freescout-help avatar Jun 18 '24 11:06 freescout-help

The APP_NEW_FETCHING_LIBRARY=true parameter is outdated and has no effect anymore.

In the latest version of FreeScout fetching errors now became more informative. So in case of any issues see https://github.com/freescout-help-desk/freescout/wiki/Fetching-Emails#troubleshooting-fetching or create a new issue specifying your error.

I'd love for any of the troubleshooting guide to have worked, but none of it has. I submitted a new issue, but an admin closed the ticket and referred me here. The error I received is similar to the OP, but the number of my error is 391. I use MS365 for email and SMTP, IMAP, and all other necessary protocols are enabled. No ports are blocked on my server, and other devices I use do allow in and outbound traffic over SMTP, so it is doubtful that my infrastructure is the problem. I cannot find the .env file to enable debugging, and can't seem to fins a thread that point to its location, so I'm kind of hamstrung here. If I could find the .env file, I could enable debugging and check to make sure the file is correct with regard to the fetching library, but alas, it is elusive. If you can point me in the right direction, I'd be grateful.

jimmie-jam avatar Jun 18 '24 12:06 jimmie-jam

@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

freescout-help avatar Jun 18 '24 13:06 freescout-help

@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

I think I have the settings correct for MS365, but because I'm hosting Freescout locally only, the URL I'm using isn't behind an SSL, and therefore can't reach the URL of the app on Entra. Is there a way to do this where I host it on my local network, but not through a proxy? I don't want this accessible via the web. This is just for our company to use to submit technology and building repair issues.

jimmie-jam avatar Jun 20 '24 14:06 jimmie-jam