Skip to content

Fetching Emails

FreeScout edited this page Oct 11, 2024 · 132 revisions

Make sure that you don't have any forwardings, routings or autoresponders configured in the email account which you connect to FreeScout (same applies to support agent emails). As it may cause infinite email loops like in this or this case.

Troubleshooting Fetching

  1. Check Fetching Emails errors in "Manage » Logs".
  2. Check fetch-emails.log in "Manage » Logs » App Logs".
  3. Try to disable "Validate Certificate" option in Fetching settings.
  4. If your mail server requires "TLS" Encryption try "TLS (+StartTLS)" and vice versa.
  5. Go to "Manage » System » Tools", click "Fetch Emails" and check the output. You can also set "Debug" checkbox to see full IMAP communication log.
  6. Make sure that schedule:run cron job is configured are running in System » Status. Some shared hostings may require to specify full path to the PHP executable (for example, /usr/local/bin/php-7.2).
  7. Check freescout fetch-emails jobs via htop tool and if there are multiple or old processes - kill them via "Kill" menu.
  8. If emails are still not being fetched try to clear cache.
  9. If your mail server does not like frequent connections try to increase "Fetch Mail Schedule" option in "Manage » Settings » Mail Settings".
  10. Make sure that something does not mark emails as "READ" in your mail server. Background fetching fetches only unread emails (see this issue).

Common Issues

imap_open(): Couldn't open stream {example.org:143/imap/novalidate-cert}. TLS/SSL failure for example.org: SSL negotiation failed

Try to change TLS to SSL or vice versa (https://stackoverflow.com/a/72376387). Also see the solution here.

If you are using Microsoft Exchange on premises, make sure that ImapProxy and PopProxy components are active in your Microsoft Exchange (see this issue).

connection setup failed

Mail service may have limitations on number of connections per minute. So if you have a lot mailboxes from time to time your mail service may block IMAP connection. You can adjust Fetching interval in "Manage » Mail Settings".

This error may be seen from time to time when using Microsoft Office 365 (see this discussion).

connection setup failed: Authentication failed

Check your IMAP login and password.

Also sometimes Microsoft Exchange IMAP connection may simply stop working throwing this error (like in this issue). In this case try to delete that account in your mail server and re-add it to FreeScout.

connection failed - stream_socket_client(): Unable to connect to ssl://imap.gmail.com:993 (Connection timed out)

This error may happen if your server can not resolve your mail server host name into IP address (see this). Also make sure that your hosting provider has not blocked IMAP/POP3 ports.

imap_open(): Couldn't open stream {mydomain.com:993/imap/ssl}. Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)

imap_open(): Couldn't open stream {imap.gmail.com:993/imap/novalidate-cert/ssl}. No such host as imap.gmail.com

These errors indicate a connection issue between your server and mail server.

imap_open(): Couldn't open stream {imap.gmail.com:993/imap/novalidate-cert/ssl}. Retrying PLAIN authentication after [AUTHENTICATIONFAILED]

Sometimes Google Workspace can ban your server's IP address - see this issue. In this case contact Google Workspace support.

imap_open(): Couldn't open stream {mail.myserver.domain:587/imap/tls}. [CLOSED] IMAP connection broken

Solution is described here

'Allowed memory size of NNN bytes exhausted' error when fetching large attachments

Increase memory_limit value in php.ini. Keep in mind that console PHP may have it's own php.ini file.

IMAP connection broken (server response)

See the solution here and discussion here.

Error: Unexpected characters at end of address

See the solution here.

Mail Providers Configuration

Google Workspace (G Suite)

Syncing via oAuth is not possible.

  1. As G Suite admin in "Apps -> G Suite -> Settings for Gmail -> End User Access" make sure that POP and IMAP access is enabled.
  2. Enable 2-Step Verification, create an App Password and use it in FreeScout (read more). According to G Suite support App Passwords will work forever - this authentication method will not be deprecated in the future.
  3. Log in as a user in Gmail and enable IMAP in Settings --> Forwarding and POP/IMAP.
  4. In FreeScout, confirm that the "Encryption" dropdown at Mailbox Settings --> Connection Settings --> Fetching Emails is set to "SSL" as opposed to "TLS".

New GSuite accounts may receive the following error: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}. Retrying PLAIN authentication after [ALERT] Please log in via your web browser: support.google.com/mail/acco; (see this issue). Just wait for a day and it will disappear.

Gmail

Syncing via oAuth is not possible.

  1. Enable 2-Step Verification, create an App Password and use it in FreeScout (read more). According to Google support App Passwords will work forever - this authentication method will not be deprecated in the future.
  2. In Gmail enable IMAP in "Settings -> Forwarding and POP/IMAP -> IMAP access".

Possible Issues

imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}. Retrying PLAIN authentication after [ALERT] Please log in via your web browser: support.google.com/mail/acco;

Allow Unknown device at https://myaccount.google.com/u/1/device-activity

You may also need to do Google's "Captcha Unlock" (https://accounts.google.com/DisplayUnlockCaptcha) to unblock FreeScout from Gmail if you are getting this error.

If you keep getting this error over and over, make sure you turn on 2FA in your Google account and set up an "App Specific Password" for FreeScout. Google seems less likely to block FreeScout using this method.

imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}. Certificate failure for imap.gmail.com

This happens due to some issues on your hosting provider, just disable Validate Certificate option on Fetching page.

imap_open(): Couldn't open stream {imap.gmail.com:993/imap/novalidate-cert/ssl}. Retrying PLAIN authentication after [AUTHENTICATIONFAILED]

Sometimes Google Workspace can ban your server's IP address - see this issue. In this case contact Google Workspace support.

Microsoft 365 Office Exchange

  • Protocol: IMAP
  • Server: outlook.office365.com
  • Port: 993
  • Encryption: SSL

Follow this instruction for OAuth.

Zoho Mail

Fetching from Zoho Mail via POP3 does not work (see this issue). Switch Zoho settings to allow IMAP connections, then set up FreeScout to retrieve via IMAP.

Clone this wiki locally