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