Cant send Mails via Nextcloud (Basic Settings)

Hello :slight_smile:

i just re-setup my Nextcloud Server and imported the data without any Problem. The instance is up an Running perfectly.

Now im trying to setup the Mail-Server under Basic Settings. But i cant connect it. Im Only getting the Message: “A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log)”

The config.php gets written correctly and the server-data is set. The Server itself can be accessed without a problem via Outlook, thunderbird, webmail, etc. but the Mail-Server doesnt work, therefore i cant send my users invitational-Mails.

I checked my firewall. The Nextcloud Server sends some Packages via Port 465 which always have been accepted. Im confused and dont get whats the problem…

Anyone any idea?

Unfortunately, you didn’t provide any valuable information, which would allow to start analysing your issue. Therefore my recommendation is

  • fill in the default issue template and provide as much information about your environment and set-up as possible.
  • describe in detail how your network setup is looking like.
  • enable debug logging and provide the available Nextcloud log information.
  • use the search function of the forum to find threads in which such kind of issues have already been discussed.

Sorry, thougt the Info was Enough. Im a new user. Where can i find the “default issue template” ?

MySetup:

  • Hyper-V Servercluster
  • Two Virtual Machines (Ubuntu 22.04. LTS)
  • One Machine Only for Nextcloud 26 with default settings and ssl-connection via lets-encrypt
    → Accessible via cloud.sittamedia.com
    → Internal IP for example “192.168.1.X”
  • One Machine for iRedMail Instance Version 1.6.2, Webinterface only internal
    → Accessible (25, 465, 587, 993, icmp) via mail.sittamedia.com an internal
    → Internal IP in DMZ for example “192.168.125.200”
  • All Clients in Network “192.168.1.X” can Access the Mailserver without a Problem
  • All Clients over the Internet can Access the Mailserver without a Problem
  • For connections from my Nextcloud Server to iRedMail are the Same Firewall Rules Applied as from Normal clients.
  • When i try to connect from Nextcloud to iRedMail i see the packets over for example port 465 in my logs which get accepted an passe through, but Nextcloud shows after 1-2 seconds the Error Code "A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log)”
  • I tried to Ping my Mailserver from my Ubuntu-Nextcloud-Host, the Pings work
  • Today i tried to connect the Nextcloud Mailapp to the Mailserver, that also doesnt work. I get the Error “Imap-Server not reachable” immediately after pressing the “Connect” Button.
  • The File “nextcloud.log” in the folder “data” is empty

I searched for other threads, but i couldnt find a working solution.

Hi,

Just try these config params (config.php): https://github.com/nextcloud/server/issues/37329

The main point is : ‘mail_smtpauth’ => 1 or ‘mail_smtpauth’ => 0…

Thanks, after a long search i finally solved it thanks to your post. Putting this into my config.php did the trick:

‘mail_smtpstreamoptions’ =>
array (
‘ssl’ =>
array (
‘allow_self_signed’ => true,
‘verify_peer’ => false,
‘verify_peer_name’ => false,
),
),

2 Likes

This config work for me.

‘mail_smtpstreamoptions’ =>
array (
‘ssl’ =>
array (
‘allow_self_signed’ => true,
‘verify_peer’ => false,
‘verify_peer_name’ => false,
),
),

Many thanks @SIME

Silly question, where abouts in the config.php do I add this?

Still error with NC 27.0.0
How can i fix it ?

same here. i’ve been trying to fix it on a german allinkl server for over 3,5hrs now.

Where abouts in the config.php do I add this?

i found the link for this issue.
My nextcloud work fine with this

‘mail_smtpstreamoptions’ =>
array (
‘ssl’ =>
array (
‘allow_self_signed’ => true,
‘verify_peer’ => false,
‘verify_peer_name’ => false,
),
),

sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php