Global mail server setting not

Sending mail to users or reset password via email is not working

Nextcloud version (eg, 18.0.2): 19.0.3
Operating system and version (eg, Ubuntu 20.04): Docker image: nextcloud:latest

The issue you are facing:
I can not use the email to reset password, to send share…
I get the following error:
An error came when sending an email. Check you parameters. (Error: Connection to tcp://ssl0.ovh.net:465 Timed Out Log data: ++ Starting Swift_SmtpTransport !! Connection to tcp://ssl0.ovh.net:465 Timed Out (code: 0))

I have tried every possible setting. Nothing work???

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

Steps to replicate it:

Set email parameter:
SMTP
Cypher: STARTTLS
Source address: noreply-nc @ nikolov.fr
authentication methode: login
Authentification required: checked
Server adress: ssl0.ovh.net : 465
identification information: xxxxx : password

Thanks for the help
vandman
The output of your Nextcloud log in Admin > Logging:

[webdav] Debug: Sabre\DAV\Exception\NotAuthenticated: Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured at <<closure>>

0. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
   Sabre\DAV\Auth\Plugin->beforeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
1. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 458
   Sabre\DAV\Server->emit("beforeMethod:HEAD", [Sabre\HTTP\Requ ... }])
2. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 251
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
3. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 319
   Sabre\DAV\Server->start()
4. /var/www/html/apps/dav/appinfo/v1/webdav.php line 82
   Sabre\DAV\Server->exec()
5. /var/www/html/remote.php line 167
   require_once("/var/www/html/a ... p")

HEAD /remote.php/webdav/InstantUpload/DCIM/%EC%95%99%EB%9C%A8%EC%99%84%EC%A7%90/20200814_162043.jpg
from 221.142.199.94 at 2020-09-21T21:52:58+00:00

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

<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' => 
 array (
 0 => 
  array (
  'path' => '/var/www/html/apps',
  'url' => '/apps',
  'writable' => false,
  ),
1 => 
  array (
  'path' => '/var/www/html/custom_apps',
  'url' => '/custom_apps',
  'writable' => true,
  ),
 ),
'trusted_proxies' => 
 array (
  0 => 'xxx.xxx.xxx.xxx',
  1 => 'xxxx:xxxx:xxxx:xxxx:xxxx::xxxx',
 ),
'overwritehost' => 'xxxxxxx',
'overwriteprotocol' => 'https',
'overwritewebroot' => '/',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => 
 array (
  'host' => 'redis',
  'port' => '6379',
  ),
'mail_sendmailmode' => 'smtp',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtpname' => 'xxxxxxxxx...',
'mail_smtppassword' => 'xxxxxxxxxxxxxx...',
'mail_smtphost' => 'ssl0.ovh.net',
'mail_smtpport' => '587',
'mail_smtpsecure' => 'tls',
'mail_from_address' => 'no-reply',
'mail_domain' => 'nc.nikolov.fr',
'mail_smtpdebug' => true,
'instanceid' => 'xxxxxxxxx',
'passwordsalt' => 'xxxxxxxxxxxxxxxxx...',
'secret' => 'xxxxxxxxxx...',
'trusted_domains' => 
 array (
  0 => 'nc.nikolov.fr',
  1 => 'onlyoffice-documentserver-data',
  ),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'mysql',
'version' => '19.0.3.1',
'overwrite.cli.url' => 'https://xxxxxxxx',
'dbname' => 'xxxxxxxxx',
'dbhost' => 'xxxxxxxx',
'dbport' => '',
'dbtableprefix' => 'xxxx_',
'mysql.utf8mb4' => true,
'dbuser' => 'xxxxxx',
'dbpassword' => 'xxxxxxx',
'installed' => true,
'overwritecondaddr' => '^xxx\\.xxx\\.xxx\\.[1-254]$',
'onlyoffice' => 
 array (
  'DocumentServerUrl' => '/oo/',
  'DocumentServerInternalUrl' => 'http://oo-document/',
  'StorageUrl' => 'https://nc.nikolov.fr/',
  ),
'maintenance' => false,
'app_install_overwrite' => 
 array (
 0 => 'dicomviewer',
 1 => 'ocr',
 2 => 'radio',
 3 => 'camerarawpreviews',
 4 => 'joplin',
 ),
'theme' => '',
'loglevel' => 0,
 'mail_smtpmode' => 'smtp',
);

The output of your Apache/nginx/system log in `/var/log
Log of traefik:

[21/Sep/2020:22:05:47 +0000] "POST /index.php/settings/admin/mailtest HTTP/2.0" 400 264 "-" "REDACTED" 93294 "nc-https@docker" "http://xxx.xxx.xxx.xxx:80" 10119ms

STARTTLS can only be used on ports which, by default, are providing unencrypted communication on e.g. port 25/tcp or 587/tcp, to switch to an encrypted session as second step. If you want to connect to port 465/tcp you can only use SSL/TLS but not STARTTLS, because it directly expects an encrypted session.

1 Like

I have tried this too:

SMTP
Cypher: SSL/TLS
Source address: noreply-nc @ nikolov.fr
authentication methode: login
Authentification required: checked
Server adress: ssl0.ovh.net : 465
identification information: xxxxx : password
```
But it does not change anything???
Vandman

Hi @vandman,

What is the response to the following command* when run from the cli of your NC server?

openssl s_client -connect ssl0.ovh.net:465

*ensure you have openssl installed!

Hi, Thanks, here is thre result:

/var/www/html# openssl s_client -connect ssl0.ovh.net:465
CONNECTED(00000003)
depth=2 C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
verify return:1
depth=0 OU = Domain Control Validated, OU = PositiveSSL Multi-Domain, CN = ns0.ovh.net
verify return:1
---
Certificate chain
 0 s:OU = Domain Control Validated, OU = PositiveSSL Multi-Domain, CN = ns0.ovh.net
   i:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
 1 s:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
   i:C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIHhTCCBm2gAwIBAgIQFnM2tPve/sdlSsuZdTti+TANBgkqhkiG9w0BAQsFADCB
jzELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTcwNQYDVQQD
Ey5TZWN0aWdvIFJTQSBEb21haW4gVmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENB
MB4XDTE5MDkxMjAwMDAwMFoXDTIxMDkxMTIzNTk1OVowXDEhMB8GA1UECxMYRG9t
YWluIENvbnRyb2wgVmFsaWRhdGVkMSEwHwYDVQQLExhQb3NpdGl2ZVNTTCBNdWx0
aS1Eb21haW4xFDASBgNVBAMTC25zMC5vdmgubmV0MIICIjANBgkqhkiG9w0BAQEF
AAOCAg8AMIICCgKCAgEA70lEjAzZPKLMrsgZE7j/ikHpjILHfBhnSvnRtvIwG6MO
+eOqbSze7JpyQLvOAP6pYF6XcM06eGzKRdJG/FmXL3xsY2Gl3UWNNH2yEuDtQ4hh
JcUmz8EeppM0kZ7cYgHsHOb3FKxbwnQOjVF/TJc+BYYK5BMDx6RPSpCd30O4Wxdr
QJSlNXzHbu8FNESxFARUBFputwocPLuIUmujVMzVoh532gGazyWb45uUq/6uVgeP
a4klTOADaSMLQrWuyemJ7MnHposymrrisGBYyzzrDZhpeVAAeQW9PBxm+pUxklvk
ArKwGjdb3rkSro7e6B/bpgeFT6NTYPPLNa3ZsZrJ0E8MxLH8Y4KYXTjohvoWpqOS
JBRzIC7MgDI8LXgAzARQe0VF5FAq90nbqOoS9Vme1YP2V77e6cNoZ26rrcvxGHXp
hydCPndMNSWSCmY+/fh7mS97731LnwrevMiuL5HUn/DitI3m7zRZlx6Pi6lYGAYi
04gq2U7G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eeds6NAwqD19rURd9nNIRh+AOAHYA
VYHUwhaQNgFK6gubVzxT8MDkOHhwJQgXL6OqHQcT0wwAAAFtJb8WGgAABAMARzBF
AiEAktvLwFQ2PPW6GQgn+tc+h5IvXQZCveEEYDd2whLyE2MCIFtnz78Pzvp+bv0w
7un72K9hF3bAI6gba+VGLxP0FiexMA0GCSqGSIb3DQEBCwUAA4IBAQCmWT5V1RsH
b1/LCcp4UCr9tAtTzZnZ95jQfsdeaP1DOfHg5y75/ACUErTI1oZET3Ft5f8QvrMF
loTnW08v+FB10jSa6ZblJvm5fReR3c9+ruumPqecF12aEx1dsYsstkBICpwhIn2l
OUeR9+3g9ZQpQUOczUumbdMdhoZYXIFMwsNRqQB7p6dmZELl7pbW1HO8bpQiJqLc
MyIo+LW3XAQ+ltkQyNo6YVXQQJGMSSiwMjjFUgvBEK8Ud7cvZGnZAS5sRoc/hL6q
nLgSRGjoaWXxkS8Ob09ROHIP1Blk0a+xq4qgp+tux72ydmYZ9JuxP4K4da0kRsdd
1CfZaxUPvbS6
-----END CERTIFICATE-----
subject=OU = Domain Control Validated, OU = PositiveSSL Multi-Domain, CN = ns0.ovh.net

issuer=C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA
Server Temp Key: ECDH, P-521, 521 bits
---
SSL handshake has read 4359 bytes and written 554 bytes
Verification: OK
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-SHA384
Server public key is 4096 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-SHA384
    Session-ID: B333000092BAB54E8AAB04F9C17D1EB660C2819274443E89C4965EC6A0EA3FA3
    Session-ID-ctx: 
    Master-Key: E3D784DF45C633E2A2C70414A0281B6DCCA796A9C017CC3B08BBFBC912250CD642F006FCE172E64304EFE776EB885B67
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1600890881
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: yes
---
220 GARM-105G006 Wednesday, September 23, 2020

Hi, I am in the container.
Regard,
vandman

Hi,
After a while, I got this:

/var/www/html# openssl s_client -connect ssl0.ovh.net:465
CONNECTED(00000003)
depth=2 C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
verify return:1
depth=0 OU = Domain Control Validated, OU = PositiveSSL Multi-Domain, CN = ns0.ovh.net
verify return:1
---
Certificate chain
 0 s:OU = Domain Control Validated, OU = PositiveSSL Multi-Domain, CN = ns0.ovh.net
   i:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
 1 s:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
   i:C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIHhTCCBm2gAwIBAgIQFnM2tPve/sdlSsuZdTti+TANBgkqhkiG9w0BAQsFADCB
jzELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTcwNQYDVQQD
Ey5TZWN0aWdvIFJTQSBEb21haW4gVmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENB
MB4XDTE5MDkxMjAwMDAwMFoXDTIxMDkxMTIzNTk1OVowXDEhMB8GA1UECxMYRG9t
YWluIENvbnRyb2wgVmFsaWRhdGVkMSEwHwYDVQQLExhQb3NpdGl2ZVNTTCBNdWx0
aS1Eb21haW4xFDAS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09ROHIP1Blk0a+xq4qgp+tux72ydmYZ9JuxP4K4da0kRsdd
1CfZaxUPvbS6
-----END CERTIFICATE-----
subject=OU = Domain Control Validated, OU = PositiveSSL Multi-Domain, CN = ns0.ovh.net

issuer=C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA
Server Temp Key: ECDH, P-521, 521 bits
---
SSL handshake has read 4359 bytes and written 554 bytes
Verification: OK
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-SHA384
Server public key is 4096 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-SHA384
    Session-ID: B333000092BAB54E8AAB04F9C17D1EB660C2819274443E89C4965EC6A0EA3FA3
    Session-ID-ctx: 
    Master-Key: E3D784DF45C633E2A2C70414A0281B6DCCA796A9C017CC3B08BBFBC912250CD642F006FCE172E64304EFE776EB885B67
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1600890881
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: yes
---
220 GARM-105G006 Wednesday, September 23, 2020
  
read:errno=0

???

Hi, I found the solution:
As mentioned before, the setting was incorect. The thing is that I changed it on the web interface, but the change was not taken into consideration. On the screen, the change was made, but the configuration.php file did not change. There was no warning saying that configuration.php needed to be writable by nextcloud.
So I got confused as I thought I modified the configuration.

Thanks for those who tried to help me.
Regards
vandman

1 Like

Are you speaking about the “config.php” file?

yes, I mixed up with joomla. I work on it at work at the moment.
Regards