Mail App does not work with TLS on SMTP and IMAP

I have a mailserver with which is authentificated and uses TLS on the smtp and the imap. Its using the default Port 143 and 587.
If I configure that in the mailapp, he warns “cannot connect to mailserver”.
On previous versions of the mail-app(< 1.1.3) it was at least configureable without smtp, so that I can at least see the incoming mails. Now it does not work at all anymore.
On other clients (thunderbird, iphone, outlook,…) it does work.

PS: The mailserver is resolveable from the clients and from the nextcloud instance with the /etc/hosts-file of the nextcloud-server.

If I try to add the account again I receive the error: “Error Connecting to Server” and I cannot even add it anymore.

  • There is no requests received by the mailserver at all.

Can someone help me?

The erros in the logs:

OCA\Mail\Exception\ServiceException: Could not sync messages
/var/www/nextcloud/apps/mail/lib/Controller/FoldersController.php - line 102:

OCA\Mail\Service\MailManager->syncMessages(OCA\Mail\Account {}, OCA\Mail\IMAP\Sync\Request {})

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OCA\Mail\Controller\FoldersController->sync(13, “XXXX”, “XXXX =”, []) //XXXX is just anonymizez

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:

OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Con … {}, “sync”)

/var/www/nextcloud/lib/private/AppFramework/App.php - line 126:

OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con … {}, “sync”)

/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main(“OCA\Mail\ … r”, “sync”, OC\AppFramew … {}, { accountId: … "})

<>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ accountId: … "})

/var/www/nextcloud/lib/private/Route/Router.php - line 297:

call_user_func(OC\AppFramew … {}, { accountId: … "})

/var/www/nextcloud/lib/base.php - line 997:

OC\Route\Router->match("/apps/mail/ … c")

/var/www/nextcloud/index.php - line 42:

OC::handleRequest()

Verursacht vonHorde_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 1598:

Horde_Imap_Client_Base->login("*** sensiti … *")

/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 4038:

Horde_Imap_Client_Base->status(Horde_Imap_Client_Mailbox {}, 8713)

/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 3632:

Horde_Imap_Client_Base->_syncStatus(Horde_Imap_Client_Mailbox {})

/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php - line 61:

Horde_Imap_Client_Base->sync(Horde_Imap_Client_Mailbox {}, “XXXXXX”, { ids: Horde … }}) //XXXX is just anonymize

/var/www/nextcloud/apps/mail/lib/Service/MailManager.php - line 116:

OCA\Mail\IMAP\Sync\Synchronizer->sync(Horde_Imap_C … e}, OCA\Mail\IMAP\Sync\Request {})

/var/www/nextcloud/apps/mail/lib/Controller/FoldersController.php - line 102:

OCA\Mail\Service\MailManager->syncMessages(OCA\Mail\Account {}, OCA\Mail\IMAP\Sync\Request {})

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OCA\Mail\Controller\FoldersController->sync(13, “XXXX”, “XXXX=”, []) // XXXX is just anonymized

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:

OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Con … {}, “sync”)

/var/www/nextcloud/lib/private/AppFramework/App.php - line 126:

OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con … {}, “sync”)

/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main(“OCA\Mail\ … r”, “sync”, OC\AppFramew … {}, { accountId: … "})

<>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ accountId: … "})

/var/www/nextcloud/lib/private/Route/Router.php - line 297:

call_user_func(OC\AppFramew … {}, { accountId: … "})

/var/www/nextcloud/lib/base.php - line 997:

OC\Route\Router->match("/apps/mail/ … c")

/var/www/nextcloud/index.php - line 42:

OC::handleRequest()

Have the mistake too.
“OCA\Mail\Exception\ServiceException: Could not sync messages”

/var/www/nextcloud/apps/mail/lib/Controller/FoldersController.php - line 102:

OCA\Mail\Service\MailManager->syncMessages(OCA\Mail\Account {}, OCA\Mail\IMAP\Sync\Request {})

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OCA\Mail\Controller\FoldersController->sync(14, "xxxxxxxxxx=", "xxxxxxxxxx", [ "13","12","11","10","9"])

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:

OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Con ... {}, "sync")

/var/www/nextcloud/lib/private/AppFramework/App.php - line 125:

OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con ... {}, "sync")

/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main("OCA\\Mail\\ ... r", "sync", OC\AppFramew ... {}, { accountId: ... "})

<<closure>>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ accountId: ... "})

/var/www/nextcloud/lib/private/Route/Router.php - line 299:

call_user_func(OC\AppFramew ... {}, { accountId: ... "})

/var/www/nextcloud/lib/base.php - line 1008:

OC\Route\Router->match("/apps/mail/ ... c")

/var/www/nextcloud/index.php - line 38:

OC::handleRequest()

Nextcloud 18.0.1
App version 1.1.3
comes every 5-15 min
5 Email address

Attention: An update on NC 18 + update of all apps solved the issue for me

I Have the same ISSUE. An Update on Nextcloud 18.0.3 did not solve the issue. Stiil there.

See my thread: Nextcloud 18.02 nach Update App Email 1.14, Error

I have same issue after Update to 18.0.3 and mail update to 1.1.4

Communication with mail server is not working.

Using TLS new Verification Flag in config.php app.mail.verify-tls-peer = false Does not work.!

Remove App and new install does not work too!

Stacktrace after Update:

OCA\Mail\Exception\ServiceException: Could not get message IDs: Error connecting to mail server.

/srv/www/apps/nextcloud/apps/mail/lib/Controller/MessagesController.php - line 154:

OCA\Mail\Service\MailSearch->findMessages(OCA\Mail\Account {}, "INBOX", null, null)

/srv/www/apps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OCA\Mail\Controller\MessagesController->index(6, "SU5CT1g=", null, null)

/srv/www/apps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:

OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Con ... {}, "index")

/srv/www/apps/nextcloud/lib/private/AppFramework/App.php - line 125:

OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con ... {}, "index")

/srv/www/apps/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main("OCA\\Mail\\ ... r", "index", OC\AppFramew ... {}, { accountId: ... "})

<<closure>>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ accountId: ... "})

/srv/www/apps/nextcloud/lib/private/Route/Router.php - line 299:

call_user_func(OC\AppFramew ... {}, { accountId: ... "})

/srv/www/apps/nextcloud/lib/base.php - line 1008:

OC\Route\Router->match("/apps/mail/ ... s")

/srv/www/apps/nextcloud/index.php - line 38:

OC::handleRequest()

Caused by Horde_Imap_Client_Exception: Error connecting to mail server.

/srv/www/apps/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php - line 227:

Horde_Imap_Client_Socket->_connect()

/srv/www/apps/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 654:

Horde_Imap_Client_Socket->_initCapability()

/srv/www/apps/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 399:

Horde_Imap_Client_Base->_capability()

/srv/www/apps/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php - line 190:

Horde_Imap_Client_Base->__get("capability")

/srv/www/apps/nextcloud/apps/mail/lib/IMAP/Search/SearchStrategyFactory.php - line 35:

Horde_Imap_Client_Socket->__get("capability")

/srv/www/apps/nextcloud/apps/mail/lib/Service/MailSearch.php - line 109:

OCA\Mail\IMAP\Search\SearchStrategyFactory->getStrategy(Horde_Imap_C ... e}, "INBOX", Horde_Imap_C ... {}, null)

/srv/www/apps/nextcloud/apps/mail/lib/Controller/MessagesController.php - line 154:

OCA\Mail\Service\MailSearch->findMessages(OCA\Mail\Account {}, "INBOX", null, null)

/srv/www/apps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OCA\Mail\Controller\MessagesController->index(6, "SU5CT1g=", null, null)

/srv/www/apps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:

OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Con ... {}, "index")

/srv/www/apps/nextcloud/lib/private/AppFramework/App.php - line 125:

OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con ... {}, "index")

/srv/www/apps/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main("OCA\\Mail\\ ... r", "index", OC\AppFramew ... {}, { accountId: ... "})

<<closure>>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ accountId: ... "})

/srv/www/apps/nextcloud/lib/private/Route/Router.php - line 299:

call_user_func(OC\AppFramew ... {}, { accountId: ... "})

/srv/www/apps/nextcloud/lib/base.php - line 1008:

OC\Route\Router->match("/apps/mail/ ... s")

/srv/www/apps/nextcloud/index.php - line 38:

OC::handleRequest()

The Nextcloud mail app offers an extensive logging system to make it easier identifying and tracking down bugs. Please enable debug mode and set the log level to debug in your admin settings. Then, try to reproduce your issue and take another look at data/nextcloud.log, data/horde_imap.log and data/horde_smtp.log.

Changed logging to debug (0)

Selecting Mail app in Frontend.

  • No horde_imap.log written
  • No horde_smtp.log written

Additional content in nextcloud.log:

{“reqId”:“LUlqXoycpO3w4kKWDTHH”,“level”:0,“time”:“2020-03-25T08:53:00+00:00”,“remoteAddr”:“79.212.69.125”,“user”:"–",“app”:“cron”,“method”:“GET”,“url”:"/cron.php",“message”:“Run OCA\Talk\BackgroundJob\ExpireSignalingMessage job with ID 244”,“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0”,“version”:“18.0.3.0”}
{“reqId”:“LUlqXoycpO3w4kKWDTHH”,“level”:0,“time”:“2020-03-25T08:53:00+00:00”,“remoteAddr”:“79.212.69.125”,“user”:"–",“app”:“cron”,“method”:“GET”,“url”:"/cron.php",“message”:“Finished OCA\Talk\BackgroundJob\ExpireSignalingMessage job with ID 244 in 0 seconds”,“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0”,“version”:“18.0.3.0”}

Seems to not call the mail server connect anymore!
In between I removed the mail app and reinstalled it.

See my previous reply. You have to enable debug mode as well.

Thx for your support. It was an configuration problem:
config.php app.mail.verify-tls-peer = false Does work!

Hi,

I ended up with a non-working mail app as well because of an internal certificate. I had to use that verify-peer-tls option. Back in business now but would like to know if there is a way for me to provide the app with my CA certificate for it to verify the internal certificate ?

Thanks,

See https://github.com/nextcloud/mail/issues/2785 :slight_smile:

This topic was automatically closed after 27 days. New replies are no longer allowed.