Account creation failed: Error connecting to mail server

Hello everyone, good afternoon.

I am trying to connect my GSuite account to the system, but it doesn’t work.
I’ve tried everything and always give the same mistake.
Account creation failed: Error connecting to mail server.

I followed this tutorial too, because I have 2FA enabled, however, but this does not work.
Any idea ?
https://community.nethserver.org/t/nextcloud-gmail-email-account-config/11332

what does your nextcloud.log say?

Hello.
Good afternoon, how are you ?

this is the Log.

(I removed the restricted information)

{“reqId”:“ID”,“level”:4,“time”:“2019-12-10T19:21:25+00:00”,“remoteAddr”:“IP”,“user”:“USER”,“app”:“mail”,“method”:“POST”,“url”:"/index.php/apps/mail/api/accounts",“message”:“Creating account failed: Error connecting to mail server.”,“userAgent”:“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36”,“version”:“17.0.1.1”}

I’m not entirely sure but it looks like your outgoing SMTP connection doesn’t work. Do your php settings allow SMTP? Is it maybe blocked by a firewall?

Both my server and PHP allow SMTP.

I believe it is related to 2-step verification

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.

Hi , i have problem to configure nextcloud with local sendmail/dovecot. On that server Horde is working perfectly.
Anyway i have try to install new server postfix/dovecot. i have made debug level to 0 and i receive

Sun, 24 May 2020 21:21:40 +0000
Connection to: imap://testnext.gk-tron.de/
Server connection took 0.0989 seconds.
S: * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
C: 1 STARTTLS
S: 1 OK Begin TLS negotiation now.

Command 1 took 0.0003 seconds.


Sun, 24 May 2020 21:24:17 +0000
Connection to: imap://testnext.gk-tron.de/
Server connection took 0.111 seconds.
S: * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
C: 1 STARTTLS
S: 1 OK Begin TLS negotiation now.

Command 1 took 0.0004 seconds.
mail is working from some windows local machine with thunderbird. i dont know where else to search.
Thanks,
Pedja

I have forgot to mention, i have successfully send mail from settings , but for users does not allow Authentication method Plain without Authentication. What i am doing wrong ?

Best regards,
Pedja

The Mail app only allows authenticated transmission.

Your problem is unrelated to the topic discussed here. Start a new topic for any follow-up questions.

Greetings, I hope this can help many with the error problem when configuring sending SMTP mail, try this command, I save myself after many days looking for the solution:
setsebool -P httpd_can_sendmail on
here the source: https://docs.nextcloud.com/server/15/admin_manual/installation/selinux_configuration.html