# Mail cannot open message from IMAP ProtonMail Bridge

**URL:** <https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077>\
**Category:** ℹ️ Support\
**Created:** [January 21, 2021, 1:32am UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077 "2021-01-21T01:32:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![NekDeepInBits](https://help.nextcloud.com/letter_avatar/nekdeepinbits/32/5_5575768a8748004e209b776fc1b2916d.png) [@NekDeepInBits](https://help.nextcloud.com/u/NekDeepInBits)\
**Post date:** [January 21, 2021, 1:32am UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/1 "2021-01-21T01:32:40Z")

</div>

**Versions:**  
NextCloud from the Hansson IT image  
Ubuntu 20.04  
NextCloud 20.05  
NextCloud Mail 1.8.0  
ProtonMail Bridge 1.5.4  
Apache 2.4.41  
PHP version 7.4.3-4

**The issue you are facing:**  
Mail, using ProtonMail Bridge can load list of messages by box, can load message subject in preview pane, but cannot load body of email message.

Any help offered is greatly appreciated.

**Is this the first time you’ve seen this error? :** Y

**Steps to replicate it:**

Proton Mail Bridge is configured to successfully connect to supported account type (two factor removed just in case).  
NextCloud User’s Mail settings under [Manual]

```auto
IMAP Host : 127.0.0.1
IMAP Security : StartTLS
IMAP Port : 1143
Username / Password verified against Bridge config

SMTP Host : 127.0.0.1
SMTP Security : StartTLS
SMTP Port : 1025
Username / Password verfied against Bridge config

```

1. Save config.
2. Click on InBox.
3. UI shows list of emails, along with icons to the left.
4. Select a message from the list, UI shows Message Subject in the preview pane, nothing more.
5. Click the subject in the preview pane to expand the message to view the Body, the spinning circle starts and never ends.

**NextCloud Log**

```auto
Error	mail	OCA\Mail\Exception\ServiceException: Could not load message
    /var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php - line 249:
    OCA\Mail\Service\MailManager->getImapMessage()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:
    OCA\Mail\Controller\MessagesController->getBody()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:
    OC\AppFramework\Http\Dispatcher->executeController()
    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:
    OC\AppFramework\Http\Dispatcher->dispatch()
    /var/www/nextcloud/lib/private/Route/Router.php - line 309:
    OC\AppFramework\App::main()
    /var/www/nextcloud/lib/base.php - line 1008:
    OC\Route\Router->match()
    /var/www/nextcloud/index.php - line 37:
    OC::handleRequest()
Caused by OCP\AppFramework\Db\DoesNotExistException: Mail body for this mail(7) could not be loaded
    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 550:
    OCA\Mail\Model\IMAPMessage->loadBodyData()
    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 424:
    OCA\Mail\Model\IMAPMessage->handleHtmlMessage()
    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 373:
    OCA\Mail\Model\IMAPMessage->getPart()
    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 94:
    OCA\Mail\Model\IMAPMessage->loadMessageBodies()
    /var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php - line 222:
    OCA\Mail\Model\IMAPMessage->__construct()
    <<closure>>
    OCA\Mail\IMAP\MessageMapper->OCA\Mail\IMAP\{closure}("*** sensiti ... *")
    /var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php - line 236:
    array_map()
    /var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php - line 64:
    OCA\Mail\IMAP\MessageMapper->findByIds()
    /var/www/nextcloud/apps/mail/lib/Service/MailManager.php - line 182:
    OCA\Mail\IMAP\MessageMapper->find()
    /var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php - line 249:
    OCA\Mail\Service\MailManager->getImapMessage()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:
    OCA\Mail\Controller\MessagesController->getBody()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:
    OC\AppFramework\Http\Dispatcher->executeController()
    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:
    OC\AppFramework\Http\Dispatcher->dispatch()
    /var/www/nextcloud/lib/private/Route/Router.php - line 309:
    OC\AppFramework\App::main()
    /var/www/nextcloud/lib/base.php - line 1008:
    OC\Route\Router->match()
    /var/www/nextcloud/index.php - line 37:
    OC::handleRequest()
2021-01-20T18:59:13-0600
Error	mail	OCA\Mail\Exception\ServiceException: IMAP error: Error connecting to mail server.
    /var/www/nextcloud/apps/mail/lib/Service/MailManager.php - line 128:
    OCA\Mail\IMAP\MailboxSync->sync()
    /var/www/nextcloud/apps/mail/lib/Controller/PageController.php - line 119:
    OCA\Mail\Service\MailManager->getMailboxes()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:
    OCA\Mail\Controller\PageController->index()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:
    OC\AppFramework\Http\Dispatcher->executeController()
    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:
    OC\AppFramework\Http\Dispatcher->dispatch()
    /var/www/nextcloud/lib/private/Route/Router.php - line 309:
    OC\AppFramework\App::main()
    /var/www/nextcloud/lib/base.php - line 1008:
    OC\Route\Router->match()
    /var/www/nextcloud/index.php - line 37:
    OC::handleRequest()
Caused by Horde_Imap_Client_Exception: Error connecting to mail server.
    /var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php - line 375:
    Horde_Imap_Client_Socket->_connect()
    /var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 838:
    Horde_Imap_Client_Socket->_login("*** sensiti ... *")
    /var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 1389:
    Horde_Imap_Client_Base->login("*** sensiti ... *")
    /var/www/nextcloud/apps/mail/lib/IMAP/FolderMapper.php - line 60:
    Horde_Imap_Client_Base->listMailboxes()
    /var/www/nextcloud/apps/mail/lib/IMAP/MailboxSync.php - line 103:
    OCA\Mail\IMAP\FolderMapper->getFolders()
    /var/www/nextcloud/apps/mail/lib/Service/MailManager.php - line 128:
    OCA\Mail\IMAP\MailboxSync->sync()
    /var/www/nextcloud/apps/mail/lib/Controller/PageController.php - line 119:
    OCA\Mail\Service\MailManager->getMailboxes()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:
    OCA\Mail\Controller\PageController->index()
    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:
    OC\AppFramework\Http\Dispatcher->executeController()
    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:
    OC\AppFramework\Http\Dispatcher->dispatch()
    /var/www/nextcloud/lib/private/Route/Router.php - line 309:
    OC\AppFramework\App::main()
    /var/www/nextcloud/lib/base.php - line 1008:
    OC\Route\Router->match()
    /var/www/nextcloud/index.php - line 37:
    OC::handleRequest()

```

The output of your config.php file in `/path/to/nextcloud` (make sure you remove any identifiable information!):

```auto
$CONFIG = array (
  'passwordsalt' => '---removed---',
  'secret' => '---removed---',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.X.X.X',
    2 => '---removed---',
    3 => '---removed---',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '20.0.5.2',
  'overwrite.cli.url' => 'https://---removed---/',
  'overwritehost'=>'---removed---',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncadmin',
  'dbpassword' => '---removed---',
  'installed' => true,
  'instanceid' => '---removed---',
  'upgrade.disable-web' => 'true',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'mail_smtpmode' => 'smtp',
  'remember_login_cookie_lifetime' => '1800',
  'log_rotate_size' => '0',
  'trashbin_retention_obligation' => 'auto, 180',
  'versions_retention_obligation' => 'auto, 365',
  'simpleSignUpLink.shown' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 0,
    'password' => '---removed---',
  ),
  'logtimezone' => 'America/Chicago',
  'htaccess.RewriteBase' => '/',
  'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (    
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\MarkDown',
    5 => 'OC\\Preview\\MP3',
    6 => 'OC\\Preview\\TXT',
    7 => 'OC\\Preview\\Movie',
    8 => 'OC\\Preview\\Photoshop',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\TIFF',
  ),
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'maintenance' => false,
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'app.mail.verify-tls-peer' => false,
  'app.mail.imap.timeout' => 20,
  'app.mail.smtp.timeout' => 2
);
```

---

<div class="post-metadata">

**Author:** ![NekDeepInBits](https://help.nextcloud.com/letter_avatar/nekdeepinbits/32/5_5575768a8748004e209b776fc1b2916d.png) [@NekDeepInBits](https://help.nextcloud.com/u/NekDeepInBits)\
**Post date:** [January 24, 2021, 4:10pm UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/2 "2021-01-24T16:10:33Z")

</div>

I’ve gathered some more information. Deeper log entries around a test session. It would appear that NextCloud is trying to interact with something at 192.168.0.1, which is a UBNT Secure Gateway and I dont think its going to respond with anything interesting to NextCloud Mail. NextCloud server is at 192.168.0.8 and it should be addressing the bridge at 127.0.0.1, not 192.168.0.1. I’ve looked again at the config.php and did not see an ip address other than the loopback.

Log from jq conversion of the NextCloud log follows:

```auto
{
  "reqId": "gf9AOkqQnGcpnS1yLOax",
  "level": 3,
  "time": "2021-01-24T09:39:56-06:00",
  "remoteAddr": "192.168.0.1",
  "user": "[USERNAME REMOVED]",
  "app": "mail",
  "method": "GET",
  "url": "/apps/mail/",
  "message": {
    "Exception": "OCA\\Mail\\Exception\\ServiceException",
    "Message": "IMAP error: Error connecting to mail server.",
    "Code": 11,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Service/MailManager.php",
        "line": 128,
        "function": "sync",
        "class": "OCA\\Mail\\IMAP\\MailboxSync",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Controller/PageController.php",
        "line": 119,
        "function": "getMailboxes",
        "class": "OCA\\Mail\\Service\\MailManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 169,
        "function": "index",
        "class": "OCA\\Mail\\Controller\\PageController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 100,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 152,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 309,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/mail/lib/IMAP/MailboxSync.php",
    "Line": 106,
    "Previous": {
      "Exception": "Horde_Imap_Client_Exception",
      "Message": "Error connecting to mail server.",
      "Code": 11,
      "Trace": [
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
          "line": 375,
          "function": "_connect",
          "class": "Horde_Imap_Client_Socket",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 838,
          "function": "_login",
          "class": "Horde_Imap_Client_Socket",
          "type": "->",
          "args": [
            " ***sensitive parameters replaced***"
          ]
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 1389,
          "function": "login",
          "class": "Horde_Imap_Client_Base",
          "type": "->",
          "args": [
            " ***sensitive parameters replaced***"
          ]
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/FolderMapper.php",
          "line": 60,
          "function": "listMailboxes",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/MailboxSync.php",
          "line": 103,
          "function": "getFolders",
          "class": "OCA\\Mail\\IMAP\\FolderMapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/MailManager.php",
          "line": 128,
          "function": "sync",
          "class": "OCA\\Mail\\IMAP\\MailboxSync",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Controller/PageController.php",
          "line": 119,
          "function": "getMailboxes",
          "class": "OCA\\Mail\\Service\\MailManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 169,
          "function": "index",
          "class": "OCA\\Mail\\Controller\\PageController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 100,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 152,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 309,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1008,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 37,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
      "Line": 605
    },
    "CustomMessage": "Could not load account mailboxes: IMAP error: Error connecting to mail server."
  },
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0",
  "version": "20.0.5.2"
}
{
  "reqId": "kzmVA02Ul4ffguBTCu99",
  "level": 3,
  "time": "2021-01-24T09:40:02-06:00",
  "remoteAddr": "192.168.0.1",
  "user": "[USERNAME REMOVED]",
  "app": "mail",
  "method": "GET",
  "url": "/apps/mail/api/messages/120/body",
  "message": {
    "Exception": "OCA\\Mail\\Exception\\ServiceException",
    "Message": "Could not load message",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php",
        "line": 249,
        "function": "getImapMessage",
        "class": "OCA\\Mail\\Service\\MailManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 169,
        "function": "getBody",
        "class": "OCA\\Mail\\Controller\\MessagesController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 100,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 152,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 309,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/mail/lib/Service/MailManager.php",
    "Line": 188,
    "Previous": {
      "Exception": "OCP\\AppFramework\\Db\\DoesNotExistException",
      "Message": "Mail body for this mail(7) could not be loaded",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php",
          "line": 550,
          "function": "loadBodyData",
          "class": "OCA\\Mail\\Model\\IMAPMessage",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php",
          "line": 424,
          "function": "handleHtmlMessage",
          "class": "OCA\\Mail\\Model\\IMAPMessage",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php",
          "line": 373,
          "function": "getPart",
          "class": "OCA\\Mail\\Model\\IMAPMessage",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php",
          "line": 94,
          "function": "loadMessageBodies",
          "class": "OCA\\Mail\\Model\\IMAPMessage",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php",
          "line": 222,
          "function": "__construct",
          "class": "OCA\\Mail\\Model\\IMAPMessage",
          "type": "->"
        },
        {
          "function": "OCA\\Mail\\IMAP\\{closure}",
          "class": "OCA\\Mail\\IMAP\\MessageMapper",
          "type": "->",
          "args": [
            " ***sensitive parameters replaced***"
          ]
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php",
          "line": 236,
          "function": "array_map"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php",
          "line": 64,
          "function": "findByIds",
          "class": "OCA\\Mail\\IMAP\\MessageMapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/MailManager.php",
          "line": 182,
          "function": "find",
          "class": "OCA\\Mail\\IMAP\\MessageMapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php",
          "line": 249,
          "function": "getImapMessage",
          "class": "OCA\\Mail\\Service\\MailManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 169,
          "function": "getBody",
          "class": "OCA\\Mail\\Controller\\MessagesController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 100,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 152,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 309,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1008,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 37,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php",
      "Line": 580
    },
    "CustomMessage": "Could not load message"
  },
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0",
  "version": "20.0.5.2"
}
{
  "reqId": "wyKf0AHz44Qc3z1k1mtd",
  "level": 3,
  "time": "2021-01-24T09:40:27-06:00",
  "remoteAddr": "192.168.0.1",
  "user": "[USERNAME REMOVED]",
  "app": "mail",
  "method": "POST",
  "url": "/apps/mail/api/mailboxes/22/sync",
  "message": {
    "Exception": "OCA\\Mail\\Exception\\ServiceException",
    "Message": "Sync failed for 3:INBOX: Error connecting to mail server.",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
        "line": 121,
        "function": "sync",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
        "line": 161,
        "function": "syncMailbox",
        "class": "OCA\\Mail\\Service\\Sync\\SyncService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 169,
        "function": "sync",
        "class": "OCA\\Mail\\Controller\\MailboxesController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 100,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 152,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 309,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
    "Line": 238,
    "Previous": {
      "Exception": "Horde_Imap_Client_Exception",
      "Message": "Error connecting to mail server.",
      "Code": 11,
      "Trace": [
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
          "line": 375,
          "function": "_connect",
          "class": "Horde_Imap_Client_Socket",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 838,
          "function": "_login",
          "class": "Horde_Imap_Client_Socket",
          "type": "->",
          "args": [
            " ***sensitive parameters replaced***"
          ]
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 1598,
          "function": "login",
          "class": "Horde_Imap_Client_Base",
          "type": "->",
          "args": [
            " ***sensitive parameters replaced***"
          ]
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 4038,
          "function": "status",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 3632,
          "function": "_syncStatus",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php",
          "line": 109,
          "function": "sync",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php",
          "line": 65,
          "function": "getNewMessageUids",
          "class": "OCA\\Mail\\IMAP\\Sync\\Synchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
          "line": 343,
          "function": "sync",
          "class": "OCA\\Mail\\IMAP\\Sync\\Synchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
          "line": 221,
          "function": "runPartialSync",
          "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
          "line": 121,
          "function": "sync",
          "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
          "line": 161,
          "function": "syncMailbox",
          "class": "OCA\\Mail\\Service\\Sync\\SyncService",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 169,
          "function": "sync",
          "class": "OCA\\Mail\\Controller\\MailboxesController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 100,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 152,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 309,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1008,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 37,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
      "Line": 605
    },
    "CustomMessage": "Sync failed for 3:INBOX: Error connecting to mail server."
  },
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0",
  "version": "20.0.5.2"
}
{
  "reqId": "BSlwumkE79rbtvHY1VlJ",
  "level": 3,
  "time": "2021-01-24T09:40:57-06:00",
  "remoteAddr": "192.168.0.1",
  "user": "[USERNAME REMOVED]",
  "app": "mail",
  "method": "POST",
  "url": "/apps/mail/api/mailboxes/22/sync",
  "message": {
    "Exception": "OCA\\Mail\\Exception\\ServiceException",
    "Message": "Sync failed for 3:INBOX: Error connecting to mail server.",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
        "line": 121,
        "function": "sync",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
        "line": 161,
        "function": "syncMailbox",
        "class": "OCA\\Mail\\Service\\Sync\\SyncService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 169,
        "function": "sync",
        "class": "OCA\\Mail\\Controller\\MailboxesController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 100,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 152,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 309,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
    "Line": 238,
    "Previous": {
      "Exception": "Horde_Imap_Client_Exception",
      "Message": "Error connecting to mail server.",
      "Code": 11,
      "Trace": [
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
          "line": 375,
          "function": "_connect",
          "class": "Horde_Imap_Client_Socket",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 838,
          "function": "_login",
          "class": "Horde_Imap_Client_Socket",
          "type": "->",
          "args": [
            " ***sensitive parameters replaced***"
          ]
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 1598,
          "function": "login",
          "class": "Horde_Imap_Client_Base",
          "type": "->",
          "args": [
            " ***sensitive parameters replaced***"
          ]
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 4038,
          "function": "status",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
          "line": 3632,
          "function": "_syncStatus",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php",
          "line": 109,
          "function": "sync",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php",
          "line": 65,
          "function": "getNewMessageUids",
          "class": "OCA\\Mail\\IMAP\\Sync\\Synchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
          "line": 343,
          "function": "sync",
          "class": "OCA\\Mail\\IMAP\\Sync\\Synchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
          "line": 221,
          "function": "runPartialSync",
          "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
          "line": 121,
          "function": "sync",
          "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
          "line": 161,
          "function": "syncMailbox",
          "class": "OCA\\Mail\\Service\\Sync\\SyncService",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 169,
          "function": "sync",
          "class": "OCA\\Mail\\Controller\\MailboxesController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 100,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 152,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 309,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1008,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 37,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
      "Line": 605
    },
    "CustomMessage": "Sync failed for 3:INBOX: Error connecting to mail server."
  },
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0",
  "version": "20.0.5.2"
}

```

---

<div class="post-metadata">

**Author:** ![NekDeepInBits](https://help.nextcloud.com/letter_avatar/nekdeepinbits/32/5_5575768a8748004e209b776fc1b2916d.png) [@NekDeepInBits](https://help.nextcloud.com/u/NekDeepInBits)\
**Post date:** [January 26, 2021, 8:09pm UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/3 "2021-01-26T20:09:16Z")

</div>

Does anyone have any idea why the application tries to get mail from 192.168.0.1 when it is configured for 127.0.0.1?

Forgive me, but this is at its peak of importance now. Our adoption of this solution has dwindled to one user now.

---

<div class="post-metadata">

**Author:** ![kbitzer](https://help.nextcloud.com/letter_avatar/kbitzer/32/5_5575768a8748004e209b776fc1b2916d.png) [@kbitzer](https://help.nextcloud.com/u/kbitzer)\
**Post date:** [March 18, 2021, 6:40am UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/4 "2021-03-18T06:40:55Z")

</div>

I´ve just the same problem. Posted it in the german section with no response. Would be greatfull for a hint.

---

<div class="post-metadata">

**Author:** ![Bera](https://help.nextcloud.com/letter_avatar/bera/32/5_5575768a8748004e209b776fc1b2916d.png) [@Bera](https://help.nextcloud.com/u/Bera)\
**Post date:** [September 30, 2021, 1:51pm UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/5 "2021-09-30T13:51:31Z")

</div>

> **[GitHub - emersion/hydroxide: A third-party, open-source ProtonMail CardDAV,...](https://github.com/emersion/hydroxide)**
>
> A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge - GitHub - emersion/hydroxide: A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge

Check this out!

---

<div class="post-metadata">

**Author:** ![ant0n](https://help.nextcloud.com/letter_avatar/ant0n/32/5_5575768a8748004e209b776fc1b2916d.png) [@ant0n](https://help.nextcloud.com/u/ant0n)\
**Post date:** [December 1, 2024, 3:54am UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/6 "2024-12-01T03:54:09Z")

</div>

I debugged many days and was not really posting anywhere just asking friends and ex colleagues, the fact is that the solution was posted without big announcement, it is a security topic connected to TLS…  
read here:

> **[Release v1.1.4 · nextcloud/mail](https://github.com/nextcloud/mail/releases/tag/v1.1.4)**
>
> Changelog
> 1.1.4 - 2020-03-23
> Fixed
> 
> Security: verify TLS host by default. This can be a breaking change for self-hosted servers. If you want to return to the old insecure behavior, set app.mail.ver...

Thank you to @ChristophWurst for mentioning it in the closed issue

> <https://github.com/nextcloud/mail/issues/3541>
>
> \### Expected behavior
> Mail account creation
> 
> \### Actual behavior
> "Unexpected… error occurred during account creation."
> 
> \### Mail app
> 
> \*\*Mail app version:\*\* (see apps admin page, e.g. 0.5.3)
> 1.4.1
> \*\*Mailserver or service:\*\* (e.g. Outlook, Yahoo, Gmail, Exchange,...)
> ProtonMail Bridge (\[github\](https://github.com/ProtonMail/proton-bridge)) 
> 
> \### Server configuration
> 
> \*\*Operating system\*\*: (e.g. Debian 8)
> Debian 10
> \*\*Web server:\*\* (e.g. Apache, Nginx,...)
> Apache2
> \*\*Database:\*\* (e.g. MariaDB, SQLite or PostgreSQL)
> MariaDB
> \*\*PHP version:\*\* (e.g. 7.0)
> 7.3
> \*\*Nextcloud Version:\*\* (see admin page, e.g. 13.0.2)
> 19.0.1
> \#### Client configuration
> \*\*Browser:\*\* (e.g. Firefox 48)
> Firefox 68
> \*\*Operating system:\*\* (e.g. Arch Linux)
> Still Debian 10 :P 
> 
> \### Additional Info
> \*\*Comment:\*\*
> I believe this is related to having a self-signed certificate used by the mail server. I am able to connect with other mail clients, but only after being prompted to trust the cert and confirming.
> This appears similar to the closed/stale issue #264, and possibly #3534 on the basis that this instance was migrated from Raspian on an RPi4 to it's current host (Debian on an Intel 64-bit machine.)
> 
> 
> \### Logs
> \*\*Logging admin page:\*\*
> "Could not open secure TLS connection to the IMAP server." 
> 
> \*\*\`data/nextcloud.log\`:\*\*
> \`\`\`
> {"reqId":"8rMykAcPLhia6ngn4Ox1","level":4,"time":"2020-09-04T02:25:40+00:00","remoteAddr":"127.0.0.1","user":"sauces","app":"mail","method":"PUT","url":"/apps/mail/api/accounts/2","message":"Updating account failed: Could not connect to IMAP: Could not open secure TLS connection to the IMAP server.","userAgent":"Mozilla/5.0 (X11; Linux x86\_64; rv:68.0) Gecko/20100101 Firefox/68.0","version":"19.0.1.1"}
> \`\`\`
> 
> \*\*\`data/horde\_imap.log\`:\*\*
> \`\`\`
> \>\> Fri, 04 Sep 2020 02:11:24 +0000
> \>\> Connection to: imap://127.0.0.1:1143/
> \>\> Server connection took 0.0001 seconds.
> S: \* OK \[CAPABILITY IMAP4rev1 LITERAL+ SASL-IR STARTTLS AUTH=LOGIN AUTH=PLAIN ID APPENDLIMIT\] IMAP4rev1 Service Ready
> C: 1 STARTTLS
> S: 1 OK Begin TLS negotiation now
> \>\> Command 1 took 0.0001 seconds.
> \`\`\`
> 
> \*\*\`data/horde\_smtp.log\`:\*\*  
> File does not exist at this point.

For me this solved the last dotter on the |

---

<div class="post-metadata">

**Author:** ![ant0n](https://help.nextcloud.com/letter_avatar/ant0n/32/5_5575768a8748004e209b776fc1b2916d.png) [@ant0n](https://help.nextcloud.com/u/ant0n)\
**Post date:** [December 1, 2024, 3:55am UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/7 "2024-12-01T03:55:23Z")

</div>

> [@ant0n](#):
>
> [Release v1.1.4 · nextcloud/mail · GitHub](https://github.com/nextcloud/mail/releases/tag/v1.1.4)

This can be a breaking change for self-hosted servers.

Yes it breaks protonmail-bridge 🙂 breaking change !!

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [May 22, 2025, 5:49am UTC](https://help.nextcloud.com/t/mail-cannot-open-message-from-imap-protonmail-bridge/105077/8 "2025-05-22T05:49:09Z")

</div>


