Skip to content

Fetching Emails

FreeScout edited this page Feb 27, 2024 · 110 revisions

Make sure that you don't have any routings or autoresponders configured in the email account which you connect to FreeScout. As it may cause infinite email loops like in this case.

Troubleshooting Fetching

  1. Check Fetching Emails errors in Manage » Logs.
  2. Check fetch-emails.log in Manage » Logs » App Logs.
  3. Go to "Manage » System » Tools", click "Fetch Emails" and check the output.
  4. 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).
  5. Check freescout fetch-emails jobs via htop tool and if there are multiple or old processes - kill them via "Kill" menu.
  6. If emails are still not being fetched try to clear cache.
  7. If your mail server does not like frequent connections try to increase "Fetch Mail Schedule" option in "Manage » Settings » Mail Settings".
  8. 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).

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 Services 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