Setup E-Mail-Server in docker environment

I installed Nextcloud in the docker container on my Synology DS 216. So far so good … Nextcloud can be reached over the Internet, but I cannot configure the e-mail server. I have a Bluewin and Google mail account.

I got the following error message with the Bluewin account:

With the Google account, the error message looks like this:

I changed various settings in the config.php file, but with no success.

‘mail_smtpmode’ => ‘smtp’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_smtphost’ => ‘’,
‘mail_smtpport’ => ‘465’,
‘mail_smtptimeout’ => 30,
‘mail_smtpsecure’ => ‘ssl’,
‘mail_smtpdebug’ => true,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_smtpauth’ => 1,
‘mail_smtpname’ => ‘’,
‘mail_smtppassword’ => ‘xyz’,

Thanks in advance for any help.