No announcement yet.

Random laminas IMAP Check Email Account Errors

  • Filter
  • Time
  • Show
Clear All
new posts

  • Random laminas IMAP Check Email Account Errors

    In the EspoCRM log, I've noticed recently an increasing number of laminas-mail IMAP protocol errors that occur at random times. I used to see one or two of these errors per month but now they're coming up many times a day.

    I've tried increasing the connection timeout parameter in Imap.php from 30 seconds to 120 seconds with no improvement.

    I only check personal email accounts (group emails not in use) and it's a simple system with only 2 mail accounts. Clicking the connection test button for IMAP mail always returns a 'connection is OK' message and no errors are generated in the log.

    A typical error log looks like this (though there could be many more errors):-

    [2024-04-23 02:04:02] ERROR: JobManager: Failed job running, job '6627156d4f2f02fa1'. Job CheckEmailAccounts 6317592f6a7d0c771: [0] cannot read - connection closed? /var/www/html/espocrm/vendor/laminas/laminas-mail/src/Protocol/Imap.php:143; at /var/www/html/espocrm/application/Espo/Classes/Jobs/CheckEmailAccounts.php:61.
    [2024-04-23 03:39:22] WARNING: E_WARNING: fgets(): SSL: Connection reset by peer {"code":2,"message":"fgets(): SSL: Connection reset by peer","file":"/var/www/html/espocrm/vendor/laminas/laminas-mail/src/Protocol/Imap.php","line":141}
    [2024-04-23 03:39:22] WARNING: E_WARNING: fwrite(): SSL: Broken pipe {"code":2,"message":"fwrite(): SSL: Broken pipe","file":"/var/www/html/espocrm/vendor/laminas/laminas-mail/src/Protocol/Imap.php","line":360}

    Mostly the error is 'connection closed' but I also see 'broken pipe', 'connection reset by peer' and 'cannot select inbox'.
    The increase in error frequency does not relate to any particular software upgrade, it just seems to be getting worse over the last 3 or 4 months. Has anyone else noticed this or have any suggestions on how to fix. Thanks.

    EspoCRM V8.2.3
    Outlook Integration V 1.3.1
    Microsoft Exchange 365
    Linux Mint V21.3
    Apache2 V2.4.52
    PHP V8.1.2
    MariaDB V10.6.16

  • #2
    Hi crmscot,

    I think that this issue does not arise on the side of EspoCRM, but on the side of the mail provider. Please look at the last answer in this thread, it may help you:


    • #3
      Thanks for your reply lazovic. Because this issue has not appeared following any EspoCRM upgades, I tend to agree that it could be an issue with the Exchange 365 server. I have also noticed an increasing number to times where my locally installed Outlook mail client reports 'contacting server for information' and there is a delay previewing emails in my inbox. i have contacted Microsoft support and will update this post if they provide a solution that may help other users.


      • #4
        Quick update. I've been in touch with Microsoft Tech Support and they ran diagnostics on the Exchange Server "to check latency". Since they did that, the number of errors reduced from about 20-30 per day to 2-3 - but they say they have no access to any parameter that will control latency!!