Nextcloud mail can't connect to mailserver

NethServer Version: 7.8.2003
Module: nextcloud

i enabled the mail app of nextcloud and tried to connect a user to its dovecot mail account running on the server. Whatever I tried, I always get the following failure message:
[mail] Fatal: Creating account failed: Could not connect to IMAP: Could not open secure TLS connection to the IMAP server.

POST /nextcloud/index.php/apps/mail/api/accounts
from 192.168.xx.xx by C48AE11C-E887-475A-8E4E-9E08EEC7DA2D at 2020-07-30T12:07:15+00:00

The connection works fine with SOGo, Thunderbird and some other mailclients.

Any ideas?

Regards Pete

I just installed the Mail app on Nextcloud and it works fine.
Did you set up the account “Auto” or “Manual”?
My first setting with “Auto” gave me the error “Account creation failed”.
Then I seted “Manual” the account (IMAP: SSL / TLS; SMTP: STARTTLS were “by default”) and it works fine.



Hi Gabriel,
I tried both ways but no success.

Rgds Pete

Hi Pete,

Your Nextcloud can be accessed from Internet or only from LAN?

My server is running in a DMZ, it is possible to connect from Internet & LAN.

Hi Pete,

Sorry, it was a stupid question which has nothing to do with this issue.
My Nextcloud is also in DMZ.

Sorry for the following questions, but we must to be sure that all settings are good:
Mail Nexcloud - Manual config:

  • IMAP Host: your FQDN email server

  • IMAP Security: None / SSL/TLS / STARTTLS

  • IMAP Port: 143 / 993 / 143

  • IMAP User: your full email account

  • SMTP Host: your FQDN email server

  • SMTP Security: None / SSL/TLS / STARTTLS

  • IMAP Port: 587 / 465 / 587

  • IMAP User: your full email account

BOLD: works for me, default settings
I have Let’s Encrypt certificate on my email server.

All ports should be opened from WAN to DMZ in your firewall (port forwarding).

1 Like

Hi Gabriel,
trying different settings I’ve found a solution. On my stationary PCs (within local LAN) I use the “local” domain for SOGo, Thunderbird etc. . Therefore I tried the local domain and the IP of the local network with the nextcloud app as well - without success. But with the “external” domain it works.
It seems that I’ve made a mistake during the configuration of the LAN and have to check that.

1 Like

Hi Pete,

Glad to hear that everything is OK!

Have a nice weekend!

Kind regards,

You too
Thanks for your help.

Regards Pete

1 Like