Can't send email notifications in nextcloud

Hi All,

I’m new here and I have tried installing nextlcoud 17.0.1 version. I’m trying to send email notifications. I have tried several ways and still getting errors. My email server has a commercial SSL certificate.

Nextcloud server runs behind a nginx proxy server and Letsencrypt is installed via Certbot.

This is the error I’m getting when try to check email settings. The below error comes when I tried STARTTLS with the 587 port.


> A problem occurred while sending the email. Please revise your settings. (Error: Unable to connect with TLS encryption Log data: ++ Starting Swift_SmtpTransport << 220 abc.mailhost.com ESMTP Postfix >> EHLO nextcloud.qwe.host.com << 250-abc.mailhost.com  250-PIPELINING 250-SIZE 44040192 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250-DSN 250 CHUNKING >> STARTTLS << 220 2.0.0 Ready to start TLS !! Unable to connect with TLS encryption (code: 0))

The below error comes when I tried SSL/TLS with the 465 port.


A problem occurred while sending the email. Please revise your settings. (Error: Connection could not be established with host *.*.*.*[ #0] Log data: ++ Starting Swift_SmtpTransport !! connection could not be established with host *.*.*.*[ #0] (code: 0))

Telnetting to my email server from nextcloud is connected for both 587 and 465 ports.
My email server 465/587 ports are all open.

‘overwriteprotocol’ => ‘https’,
‘mail_smtpdebug’ => true,
‘mail_smtpmode’ => ‘smtp’,
‘mail_smtphost’ => ‘abc.com’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_domain’ => ‘abc.com’,
‘mail_from_address’ => ‘nextcloud’,
‘maintenance’ => false,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_smtpport’ => ‘587’,
‘mail_smtpauth’ => 1,
‘mail_smtpname’ => ‘nextcloud’,
‘mail_smtppassword’ => ‘**************’,
‘mail_smtpsecure’ => ‘tls’,

Do I have to point my email commercial cert files to nextcloud config file? That’s the only this I couldn’t try because could not find the parameter for that.

I have tried many ways but did not succeed at all. Can anyone here be able to help me?

Hi,

please try to add following array to your config as it is described here Email — Nextcloud latest Administration Manual latest documentation

"mail_smtpstreamoptions" => array(
    'ssl' => array(
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false
    )
),

Hi. Thaks for your reply. But I tried it and still the same.

seen this?
[Bug]: NEXTCLOUD 26 Email Setup no Test successfully · Issue #37329 · nextcloud/server · GitHub

One guy reported the following

I have the same problem with the patch in 26.0.1. But these parameters in config.php save my life and mail is now ok. The main difference is ‘mail_smtpauth’ => 0 instead of ‘mail_smtpauth’ => ‘’.

'mail_smtpmode' => 'smtp',
'mail_smtpauthtype' => '',
'mail_smtphost' => 'XXX.XXX.XXX.XXX',
'mail_smtpport' => '25',
'mail_smtptimeout' => 30,
'mail_sendmailmode' => 'smtp',
'mail_from_address' => 'no-reply',
'mail_domain' => 'mondomaine.fr',
'mail_send_plaintext_only' => false,
'mail_smtpauth' => 0,
'mail_smtpname' => '',
'mail_smtppassword' => '',
'mail_smtpstreamoptions' => array(
'ssl' => array(
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false
)
),

that differs from your config …