Problem with SMTP configuration

After the successful installation of Nextcloud using this playbook I am trying to setup the SMTP server.

When I fill in the credential in the Nextcloud GUI I get the following error:

Connection could not be established with host smtp.domain.tld [Operation timed out #110])

I used the same credentials and settings that I used in Thunderbird and there it worked. So, the problem doesn’t seem to lie in the credentials, settings or mailprovider.

I also opened an issue in the repository. Where I said that I’ve tried the following things:

sudo docker exec --user www-data nextcloud php occ config:system:set mail_smtptimeout --value="30"

&

sudo ufw allow 465

Which both didn’t work. There is a topic in this forum about this, but I didn’t find my solution there.

Any ideas?

All the best,