Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can’t send emails in a new install: “Could not send message: Could not open secure TLS connection to the server” #3368

Closed
ghost opened this issue Jul 14, 2020 · 12 comments

Comments

@ghost
Copy link

ghost commented Jul 14, 2020

Expected behavior

I installed Nextcloud with Postfix + Dovecot + Rspamd + PostgreSQL in a Debian 10 VPS according to this guide. And now everything works until I try to send an email (I can receive emails just fine thoug).

Actual behavior

Then when I try to send an email it shows Error 500. And the log show this:

Jul 14 06:46:36 mail nextcloud[26951]: {"reqId":"CLe5VcGkSBnzs1ZjHhGx","level":4,"time":"2020-07-13T22:46:36-05:00","remoteAddr":"2800:370:c1:cde0:5d25:be47:899e:7634","user":"my@email.com","app":"mail","method":"POST","url":"/index.php/apps/mail/api/accounts/1/send","message":"Sending mail failed: Could not send message: Could not open secure TLS connection to the server.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":"18.0.6.0"}
Jul 14 06:46:36 mail nextcloud[26951]: {"reqId":"CLe5VcGkSBnzs1ZjHhGx","level":3,"time":"2020-07-13T22:46:36-05:00","remoteAddr":"2800:370:c1:cde0:5d25:be47:899e:7634","user":"my@email.com","app":"mail","method":"POST","url":"/index.php/apps/mail/api/accounts/1/send","message":"{\"Exception\":\"OCA\\\\Mail\\\\Exception\\\\ServiceException\",\"Message\":\"Could not send message: Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,24]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Probando envio de correos\",\"Y estoy seguro de que no funcionar\\u00e1\",\"mypersonalemail@gmail.com\",\"\",\"\",false,24,null,null,[],null]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":99,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/App.php\",\"line\":125,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php\",\"line\":47,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\",\"args\":[\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"send\",{\"__class__\":\"OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"function\":\"__invoke\",\"class\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\",\"type\":\"->\",\"args\":[{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/private/Route/Router.php\",\"line\":299,\"function\":\"call_user_func\",\"args\":[{\"__class__\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/base.php\",\"line\":1008,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\",\"args\":[\"/apps/mail/api/accounts/1/send\"]},{\"file\":\"/var/www/nextcloud/index.php\",\"line\":38,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\",\"args\":[]}],\"File\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"Line\":176,\"Previous\":{\"Exception\":\"Horde_Mime_Exception\",\"Message\":\"Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php\",\"line\":479,\"function\":\"send\",\"class\":\"Horde_Mime_Part\",\"type\":\"->\",\"args\":[\"mypersonalemail@gmail.com\",{\"__class__\":\"Horde_Mime_Headers\"},{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"}]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"line\":174,\"function\":\"send\",\"class\":\"Horde_Mime_Mail\",\"type\":\"->\",\"args\":[{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"},false,false]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,24]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Probando envio de correos\",\"Y estoy seguro de que no funcionar\\u00e1\",\"mypersonalemail@gmail.com\",\"\",\"\",false,24,null,null,[],null]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":99,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/App.php\",\"line\":125,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php\",\"line\":47,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\",\"args\":[\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"send\",{\"__class__\":\"OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"function\":\"__invoke\",\"class\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\",\"type\":\"->\",\"args\":[{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/private/Route/Router.php\",\"line\":299,\"function\":\"call_user_func\",\"args\":[{\"__class__\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/base.php\",\"line\":1008,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\",\"args\":[\"/apps/mail/api/accounts/1/send\"]},{\"file\":\"/var/www/nextcloud/index.php\",\"line\":38,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\",\"args\":[]}],\"File\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php\",\"Line\":1642,\"Previous\":{\"Exception\":\"Horde_Mail_Exception\",\"Message\":\"Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php\",\"line\":1620,\"function\":\"send\",\"class\":\"Horde_Mail_Transport_Smtphorde\",\"type\":\"->\",\"args\":[\"mypersonalemail@gmail.com\",{\"From\":\"Pedro Stein <my@email.com>\",\"To\":\"mypersonalemail@gmail.com\",\"Cc\":\"\",\"Subject\":\"Probando envio de correos\",\"Message-ID\":\"<20200714034636.Horde.sfMqbkEOKZ3W96hIXTc1F5r@mail.email.com>\",\"User-Agent\":\"Horde Application Framework 5\",\"Date\":\"Tue, 14 Jul 2020 03:46:36 +0000\",\"Content-Type\":\"text/plain; charset=utf-8\",\"MIME-Version\":\"1.0\",\"Content-Transfer-Encoding\":\"quoted-printable\"},null]},{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php\",\"line\":479,\"function\":\"send\",\"class\":\"Horde_Mime_Part\",\"type\":\"->\",\"args\":[\"mypersonalemail@gmail.com\",{\"__class__\":\"Horde_Mime_Headers\"},{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"}]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"line\":174,\"function\":\"send\",\"class\":\"Horde_Mime_Mail\",\"type\":\"->\",\"args\":[{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"},false,false]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,24]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Probando envio de correos\",\"Y estoy seguro de que no funcionar\\u00e1\",\"mypersonalemail@gmail.com\",\"\",\"\",false,24,null,null,[],null]},{\"file\

Then I tried adding this to config.php according to a note on the changelogs:

'app.mail.verify-tls-peer' => false,

But it didn't work either:

Jul 14 16:58:02 mail nextcloud[27662]: {"reqId":"HboQ2ObJPRe0fJXTgNup","level":4,"time":"2020-07-14T08:58:02-05:00","remoteAddr":"2800:370:c1:cde0:5d25:be47:899e:7634","user":"pedro@mydomain.com","app":"mail","method":"POST","url":"/index.php/apps/mail/api/accounts/1/send","message":"Sending mail failed: Could not send message: Could not open secure TLS connection to the server.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":"18.0.6.0"}
Jul 14 16:58:02 mail nextcloud[27662]: {"reqId":"HboQ2ObJPRe0fJXTgNup","level":3,"time":"2020-07-14T08:58:02-05:00","remoteAddr":"2800:370:c1:cde0:5d25:be47:899e:7634","user":"pedro@mydomain.com","app":"mail","method":"POST","url":"/index.php/apps/mail/api/accounts/1/send","message":"{\"Exception\":\"OCA\\\\Mail\\\\Exception\\\\ServiceException\",\"Message\":\"Could not send message: Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,29]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Otra prueba de mail de nextcloud\",\"Ahora con la opci\\u00f3n de tls en false sin comillas en el config\",\"mypersonalemail@gmail.com\",\"\",\"\",false,29,null,null,[],null]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":99,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/App.php\",\"line\":125,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php\",\"line\":47,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\",\"args\":[\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"send\",{\"__class__\":\"OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"function\":\"__invoke\",\"class\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\",\"type\":\"->\",\"args\":[{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/private/Route/Router.php\",\"line\":299,\"function\":\"call_user_func\",\"args\":[{\"__class__\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/base.php\",\"line\":1008,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\",\"args\":[\"/apps/mail/api/accounts/1/send\"]},{\"file\":\"/var/www/nextcloud/index.php\",\"line\":38,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\",\"args\":[]}],\"File\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"Line\":176,\"Previous\":{\"Exception\":\"Horde_Mime_Exception\",\"Message\":\"Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php\",\"line\":479,\"function\":\"send\",\"class\":\"Horde_Mime_Part\",\"type\":\"->\",\"args\":[\"mypersonalemail@gmail.com\",{\"__class__\":\"Horde_Mime_Headers\"},{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"}]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"line\":174,\"function\":\"send\",\"class\":\"Horde_Mime_Mail\",\"type\":\"->\",\"args\":[{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"},false,false]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,29]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Otra prueba de mail de nextcloud\",\"Ahora con la opci\\u00f3n de tls en false sin comillas en el config\",\"mypersonalemail@gmail.com\",\"\",\"\",false,29,null,null,[],null]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":99,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/App.php\",\"line\":125,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php\",\"line\":47,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\",\"args\":[\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"send\",{\"__class__\":\"OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"function\":\"__invoke\",\"class\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\",\"type\":\"->\",\"args\":[{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/private/Route/Router.php\",\"line\":299,\"function\":\"call_user_func\",\"args\":[{\"__class__\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/base.php\",\"line\":1008,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\",\"args\":[\"/apps/mail/api/accounts/1/send\"]},{\"file\":\"/var/www/nextcloud/index.php\",\"line\":38,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\",\"args\":[]}],\"File\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php\",\"Line\":1642,\"Previous\":{\"Exception\":\"Horde_Mail_Exception\",\"Message\":\"Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php\",\"line\":1620,\"function\":\"send\",\"class\":\"Horde_Mail_Transport_Smtphorde\",\"type\":\"->\",\"args\":[\"mypersonalemail@gmail.com\",{\"From\":\"Pedro Stein <pedro@mydomain.com>\",\"To\":\"mypersonalemail@gmail.com\",\"Cc\":\"\",\"Subject\":\"Otra prueba de mail de nextcloud\",\"Message-ID\":\"<20200714135802.Horde._YJsSIdeoDQDOWf8rpCSVIs@mail.mydomain.com>\",\"User-Agent\":\"Horde Application Framework 5\",\"Date\":\"Tue, 14 Jul 2020 13:58:02 +0000\",\"Content-Type\":\"text/plain; charset=utf-8\",\"MIME-Version\":\"1.0\",\"Content-Transfer-Encoding\":\"quoted-printable\"},null]},{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php\",\"line\":479,\"function\":\"send\",\"class\":\"Horde_Mime_Part\",\"type\":\"->\",\"args\":[\"mypersonalemail@gmail.com\",{\"__class__\":\"Horde_Mime_Headers\"},{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"}]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"line\":174,\"function\":\"send\",\"class\":\"Horde_Mime_Mail\",\"type\":\"->\",\"args\":[{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"},false,false]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,29]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Otra prueba de mail de nextcloud\",\"Ahora con la opci\\u00f3n de tls en

I also verified every setup option mentioned in that guide just in case I made some typo or anything, but everything seems right.

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,...)
The webmail version ("mail" app in Nextcloud)

Server configuration

Operating system: (e.g. Debian 8)
Debian GNU/Linux 10 (Buster)

Web server: (e.g. Apache, Nginx,...)
Apache

Database: (e.g. MariaDB, SQLite or PostgreSQL)
PostgreSQL

PHP version: (e.g. 7.0)
PHP 7.3.19-1~deb10u1 (cli)

Nextcloud Version: (see admin page, e.g. 13.0.2)
18.0.6

Client configuration

Browser: (e.g. Firefox 48)
Brave Browser
Version 1.10.97 Chromium: 83.0.4103.116 (Official Build) (64-bit)

Operating system: (e.g. Arch Linux)
Linux Mint Debian Edition 4

@ChristophWurst
Copy link
Member

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 and data/horde_smtp.log.

@ghost
Copy link
Author

ghost commented Jul 15, 2020

Wow, the nextcloud log threw like 400 lines after this.
I hope it's fine that I attached the log itself and not pasted the whole log here!

I activated the debug mode and set its level to debug, and then I just logged in to nextcloud, went to the mail app and tried to send an email to my gmail address.

This is what I got from the logs:

nextcloud.log
horde_smtp.log

I tried to read throgh it but I'm not sure what I'm looking for actually.
I see a lot of errors (I tink) but I'm not sure which ones are actually important :(
Should I check for something in particular?

@no-response no-response bot removed the needs info label Jul 15, 2020
@ChristophWurst
Copy link
Member

ERROR: Server read/timeout error.

Strange. Is the server that slow? You could try increasing the timeout: https://github.com/nextcloud/mail/blob/master/doc/admin.md#smtp-timeout and set it to 20 or so.

@ghost
Copy link
Author

ghost commented Jul 15, 2020

ERROR: Server read/timeout error.

Strange. Is the server that slow? You could try increasing the timeout: https://github.com/nextcloud/mail/blob/master/doc/admin.md#smtp-timeout and set it to 20 or so.

Still the same error. But only this showed up (in nextcloud.log):

Jul 16 01:20:01 mail nextcloud[15196]: {"reqId":"wP9WmJ0d4onwPJQXTZug","level":4,"time":"2020-07-15T17:20:01-05:00","remoteAddr":"2800:370:c0:6910:4aae:c2da:4b7e:9a9f","user":"pedro@steinclass.com","app":"mail","method":"POST","url":"/index.php/apps/mail/api/accounts/1/send","message":"Sending mail failed: Could not send message: Could not open secure TLS connection to the server.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":"18.0.6.0"}
Jul 16 01:20:01 mail nextcloud[15196]: {"reqId":"wP9WmJ0d4onwPJQXTZug","level":3,"time":"2020-07-15T17:20:01-05:00","remoteAddr":"2800:370:c0:6910:4aae:c2da:4b7e:9a9f","user":"pedro@steinclass.com","app":"mail","method":"POST","url":"/index.php/apps/mail/api/accounts/1/send","message":"{\"Exception\":\"OCA\\\\Mail\\\\Exception\\\\ServiceException\",\"Message\":\"Could not send message: Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,39]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Prueba de email\",\"Prueba\",\"steinpedro@gmail.com\",\"\",\"\",false,39,null,null,[],null]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":99,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/App.php\",\"line\":125,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php\",\"line\":47,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\",\"args\":[\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"send\",{\"__class__\":\"OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"function\":\"__invoke\",\"class\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\",\"type\":\"->\",\"args\":[{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/private/Route/Router.php\",\"line\":299,\"function\":\"call_user_func\",\"args\":[{\"__class__\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/base.php\",\"line\":1008,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\",\"args\":[\"/apps/mail/api/accounts/1/send\"]},{\"file\":\"/var/www/nextcloud/index.php\",\"line\":38,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\",\"args\":[]}],\"File\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"Line\":176,\"Previous\":{\"Exception\":\"Horde_Mime_Exception\",\"Message\":\"Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php\",\"line\":479,\"function\":\"send\",\"class\":\"Horde_Mime_Part\",\"type\":\"->\",\"args\":[\"steinpedro@gmail.com\",{\"__class__\":\"Horde_Mime_Headers\"},{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"}]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"line\":174,\"function\":\"send\",\"class\":\"Horde_Mime_Mail\",\"type\":\"->\",\"args\":[{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"},false,false]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,39]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Prueba de email\",\"Prueba\",\"steinpedro@gmail.com\",\"\",\"\",false,39,null,null,[],null]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":99,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/App.php\",\"line\":125,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\"},\"send\"]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php\",\"line\":47,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\",\"args\":[\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"send\",{\"__class__\":\"OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"function\":\"__invoke\",\"class\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\",\"type\":\"->\",\"args\":[{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/private/Route/Router.php\",\"line\":299,\"function\":\"call_user_func\",\"args\":[{\"__class__\":\"OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler\"},{\"accountId\":\"1\",\"_route\":\"mail.accounts.send\"}]},{\"file\":\"/var/www/nextcloud/lib/base.php\",\"line\":1008,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\",\"args\":[\"/apps/mail/api/accounts/1/send\"]},{\"file\":\"/var/www/nextcloud/index.php\",\"line\":38,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\",\"args\":[]}],\"File\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php\",\"Line\":1642,\"Previous\":{\"Exception\":\"Horde_Mail_Exception\",\"Message\":\"Could not open secure TLS connection to the server.\",\"Code\":100,\"Trace\":[{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php\",\"line\":1620,\"function\":\"send\",\"class\":\"Horde_Mail_Transport_Smtphorde\",\"type\":\"->\",\"args\":[\"steinpedro@gmail.com\",{\"From\":\"Pedro Stein <pedro@steinclass.com>\",\"To\":\"steinpedro@gmail.com\",\"Cc\":\"\",\"Subject\":\"Prueba de email\",\"Message-ID\":\"<20200715222001.Horde.i8sV6K6zL4S8O7eoDl_E7wV@mail.steinclass.com>\",\"User-Agent\":\"Horde Application Framework 5\",\"Date\":\"Wed, 15 Jul 2020 22:20:01 +0000\",\"Content-Type\":\"text/plain; charset=utf-8\",\"MIME-Version\":\"1.0\"},null]},{\"file\":\"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php\",\"line\":479,\"function\":\"send\",\"class\":\"Horde_Mime_Part\",\"type\":\"->\",\"args\":[\"steinpedro@gmail.com\",{\"__class__\":\"Horde_Mime_Headers\"},{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"}]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php\",\"line\":174,\"function\":\"send\",\"class\":\"Horde_Mime_Mail\",\"type\":\"->\",\"args\":[{\"send8bit\":false,\"sep\":\"\\r\\n\",\"__class__\":\"Horde_Mail_Transport_Smtphorde\"},false,false]},{\"file\":\"/var/www/nextcloud/apps/mail/lib/Controller/AccountsController.php\",\"line\":345,\"function\":\"sendMessage\",\"class\":\"OCA\\\\Mail\\\\Service\\\\MailTransmission\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Mail\\\\Model\\\\NewMessageData\"},null,null,39]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":170,\"function\":\"send\",\"class\":\"OCA\\\\Mail\\\\Controller\\\\AccountsController\",\"type\":\"->\",\"args\":[1,\"Prueba de email\",\"Prueba\",\"steinpedro@gmail.com\",\"\",\"\",false,39,null,null,[],null]},{\"file\":\"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":99,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\"

And nothing in the hord_smtp log

I'm using a VPS with a single 2.6 GHz processor and 2048 MB of RAM (is it too bad?)

@ChristophWurst
Copy link
Member

Then I tried adding this to config.php according to a note on the changelogs

I'm currently out of ideas on what might be going wrong there. Does the issue persist?

@jstark1
Copy link

jstark1 commented Oct 3, 2020

i think the mail app does only not support tls 1.3 via SMTP. I connected successfully if i remove the "!TLS1.2" from the Postfix config option.
#smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1, !TLSv1.2
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1

@ChristophWurst
Copy link
Member

We don't have own own TLS implementation. This is handled by php.

@jstark1
Copy link

jstark1 commented Oct 15, 2020

After some research this patch allows the TLS1.3 SMTP connection to the server.

Client_diff.txt

@ChristophWurst
Copy link
Member

Huh, interesting. Guess we should submit this upstream. Do you or shall I? :)

@jstark1
Copy link

jstark1 commented Oct 15, 2020

please do it

@ChristophWurst
Copy link
Member

horde/Socket_Client#4

@stale
Copy link

stale bot commented Jul 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 13, 2021
@stale stale bot closed this as completed Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants