Nextcloud 28 Won't Send E-Mails to Custom Mail Servers

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Hi there

I'm trying to use my own mail server to send messages to my users.

On my production Nextcloud (v.25 and Debian 11) it works flawlessly but not on my testing Nextcloud (v.28 and Debian 12).

My mail server log returns:
**SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca**

But on both Nextcloud servers I'm using Let's Encrypt.

I even downgraded the OpenSSL version on Debian 12 to the same version (1.1.1n).

I've tried with Gmail (it works with app password) and with another custom mail server, a brazilian company like Hostgator (doesn't work with the same behaviour but for this one I don't have access to logs).

So, I'm kinda stuck here since I cannot use Google; the whole idea is to get rid of it, right :wink:

Any help would be much appreciated.


Nextcloud version (eg, 20.0.5): 28.0.3
Operating system and version (eg, Ubuntu 20.04): Debian 12
Apache or nginx version (eg, Apache 2.4.25): 2.4.57
PHP version (eg, 7.4): 8.2.7

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Go to Basic Settings → Email server
  2. Fill the inputs with my e-mail credentials
  3. Save and press button Send mail

The output of your Nextcloud log in Admin > Logging:

Nothing on Nextcloud logs, only on the web page:

*A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log)*

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'XXXXXXXX',
  'passwordsalt' => 'XXXXXXXX',
  'secret' => 'XXXXXXXX',
  'trusted_domains' => 
  array (
    0 => 'XXXXXXXXX',
  'datadirectory' => '/mnt/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'XXXXXXXX',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '3306',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXXXXXXX',
  'dbpassword' => 'XXXXXXXX',
  'installed' => true,
  'default_phone_region' => 'ISO 3166-2:BR',
  'defaultapp' => 'dashboard',
  'has_rebuilt_cache' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'log_type' => 'file',
  'logfile' => '/var/www/html/nextcloud/data/nextcloud.log',
  'app_install_overwrite' => 
  array (
    0 => 'mindmap_app',
    1 => 'admin_notifications',
    2 => 'breezedark',
    3 => 'rainloop',
    4 => 'cfg_share_links',
  'maintenance_window_start' => 1,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  'mail_from_address' => 'XXXXXXXX',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'XXXXXXXX',
  'mail_smtphost' => 'XXXXXXXX',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXXXXXXX',
  'mail_smtppassword' => 'XXXXXXXX',
  'mail_smtpdebug' => true,

The output of your Apache/nginx/system log in /var/log/____:

MY-IP - - [15/Mar/2024:12:08:35 -0300] "POST /index.php/settings/admin/mailtest HTTP/2.0" 400 849 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.


Have you tried to turn on email debugging to troubleshoot?

Also note they the mail implementation was replaced in v26 so you’re v25 experience versus v28 may require some adaptation to work:


Disabling peer verification solved my problem!

But it’s still a very strange behaviour because on this very server I can use the same configuration to send an e-mail using a pyhton script :hushed:

And this mail server that I run has STARTTLS capabilities announced at the connection moment. And it’s been running this way for 10 years now.

I just don’t understand :smile:

Anyway, thanks @jtr you saved the day !!

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.