Issue with mails

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com 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:

example

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

longer
example
here

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:

Nextcloud version (eg, 20.0.5): Newest
Operating system and version (eg, Ubuntu 20.04): Docker AIO
Apache or nginx version (eg, Apache 2.4.25): Docker AIO
PHP version (eg, 7.4): Docker AIO

The issue you are facing:
Sending mails not working:
A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log)

‘mail_from_address’ => ‘admin’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_domain’ => ‘XXX.ovh’,
‘mail_smtpauth’ => 1,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_smtphost’ => ‘XXXt’,
‘mail_smtpport’ => ‘465’,
‘mail_smtpname’ => ‘admin@XXX.ovh’,
‘mail_smtppassword’ => ‘Password’,
‘mail_smtpsecure’ => ‘ssl’,

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

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

` 3 seconds","userAgent":"--","version":"27.1.3.2","data":{"app":"cron"}}
{"reqId":"uMSE13ud2YSZkbqdBA3s","level":0,"time":"2023-11-11T16:24:40+00:00","remoteAddr":"195.60.216.10","user":"admin","app":"no app in context","method":"POST","url":"/settings/admin/mailtest","message":"Email transport \"Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport\" starting","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","version":"27.1.3.2","data":[]}
{"reqId":"uMSE13ud2YSZkbqdBA3s","level":0,"time":"2023-11-11T16:24:50+00:00","remoteAddr":"195.60.216.10","user":"admin","app":"core","method":"POST","url":"/settings/admin/mailtest","message":"Sending mail to \"Array\n(\n    [XXXX@gmail.com] => admin\n)\n\" with subject \"Email setting test\" failed","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","version":"27.1.3.2","exception":{"Exception":"Symfony\\Component\\Mailer\\Exception\\TransportException","Message":"Connection could not be established with host \"ssl://mail47.mydevil.net:465\": stream_socket_client(): Unable to connect to ssl://mail47.mydevil.net:465 (Operation timed out)","Code":0,"Trace":[{"function":"Symfony\\Component\\Mailer\\Transport\\Smtp\\Stream\\{closure}","class":"Symfony\\Component\\Mailer\\Transport\\Smtp\\Stream\\SocketStream","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/mailer/Transport/Smtp/Stream/SocketStream.php","line":157,"function":"stream_socket_client","args":["ssl://mail47.mydevil.net:465",0,"",10,4,null]},{"file":"/var/www/html/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php","line":251,"function":"initialize","class":"Symfony\\Component\\Mailer\\Transport\\Smtp\\Stream\\SocketStream","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php","line":194,"function":"start","class":"Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/mailer/Transport/AbstractTransport.php","line":72,"function":"doSend","class":"Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport","type":"->","args":[["Symfony\\Component\\Mailer\\SentMessage"]]},{"file":"/var/www/html/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php","line":136,"function":"send","class":"Symfony\\Component\\Mailer\\Transport\\AbstractTransport","type":"->","args":[["Symfony\\Component\\Mailer\\SentMessage"],["Symfony\\Component\\Mailer\\DelayedEnvelope"]]},{"file":"/var/www/html/3rdparty/symfony/mailer/Mailer.php","line":45,"function":"send","class":"Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport","type":"->","args":[["Symfony\\Component\\Mime\\Email"],null]},{"file":"/var/www/html/lib/private/Mail/Mailer.php","line":216,"function":"send","class":"Symfony\\Component\\Mailer\\Mailer","type":"->","args":[["Symfony\\Component\\Mime\\Email"]]},{"file":"/var/www/html/apps/settings/lib/Controller/MailSettingsController.php","line":168,"function":"send","class":"OC\\Mail\\Mailer","type":"->","args":[["OC\\Mail\\Message"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"sendTestMail","class":"OCA\\Settings\\Controller\\MailSettingsController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\MailSettingsController"],"sendTestMail"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\MailSettingsController"],"sendTestMail"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\MailSettingsController","sendTestMail",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["settings.MailSettings.sendTestMail"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/admin/mailtest"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/symfony/mailer/Transport/Smtp/Stream/SocketStream.php","Line":154,"message":"Sending mail to \"Array\n(\n    [maciejpawlaczyk3@gmail.com] => admin\n)\n\" with subject \"Email setting test\" failed","exception":{},"CustomMessage":"Sending mail to \"Array\n(\n    [XXX@gmail.com] => admin\n)\n\" with subject \"Email setting test\" failed"}}
`
PASTE HERE

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

PASTE HERE

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

PASTE HERE

PASTE HERE


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.

PASTE HERE

Try with

'mail_smtpport' => '587',
'mail_smtpsecure' => '',

that results in STARTTLS (the successor to ssmtp) being used.

If that does not solve it, look if you have some characters in your password that need to be escaped.

Then you can speek with your mailserver via telnet:

telnet mail.example.com 587
#Answer of Mailserver (example):
Trying xx.xxx.xxx.xx...
Connected to smtp.example.com.
Escape character is '^]'.
220 smtp-out.example.com ESMTP Postfix
# Then enter extended hello:
EHLO domain.com
# Then the mailserver answers with the options it has

or with ssl:

openssl s_client -connect mail.example.com:465
# rest is the same as with telnet

or ssl with starttls

openssl s_client -connect mail.example.com:25 -starttls smtp
# rest is the same as with telnet

Much luck,
ernolf

See: Poczta – MyDevil.net - Wiki

Porty SMTP:

    25 - PLAINTEXT/STARTTLS,
    587 - STARTTLS,
    465 - TLS.

Maybe it might help, to configure SMTP port 465 with TLS instead of SSL

This helped. Thank you all!

1 Like

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