URGENT "Error: Request failed with status code 500"

Hello,
since a few days all users in the instance cannot send mails any more. It used to work before but all we did is move Nextcloud to another server?!

After hitting send I see this:

Fehler beim Versenden der Nachricht
Error: Request failed with status code 500

I tried switching from SSL to STARTTLS but that did not help.
Sending works normal via Thunderbird with the same credentials.
Nextcould 19.0.5
Mail 1.4.1
It also works on a different test server with NC 20.0.1 Mail 1.7.0 but I cannot upgrade the production server right now.

Server log has this:
{“reqId”:“LBrgFIYpwA54Rmb1BZGv”,“level”:3,“time”:“2020-11-22T19:19:14+00:00”,“remoteAddr”:“77.183.70.112”,“user”:“alexander.mueller”,“app”:“mail”,“method”:“POST”,“url”:“/apps/mail/api/accounts/38/send”,“message”:{“Exception”:“OCA\Mail\Exception\ServiceException”,“Message”:“Could not send message: Error connecting to SMTP server.”,“Code”:1,“Trace”:[{“file”:“/data/www/nextcloud67/apps/mail/lib/Controller/AccountsController.php”,“line”:345,“function”:“sendMessage”,“class”:“OCA\Mail\Service\MailTransmission”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:170,“function”:“send”,“class”:“OCA\Mail\Controller\AccountsController”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/App.php”,“line”:137,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Routing/RouteActionHandler.php”,“line”:47,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“function”:“__invoke”,“class”:“OC\AppFramework\Routing\RouteActionHandler”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/Route/Router.php”,“line”:297,“function”:“call_user_func”},{“file”:“/data/www/nextcloud67/lib/base.php”,“line”:1010,“function”:“match”,“class”:“OC\Route\Router”,“type”:“->”},{“file”:“/data/www/nextcloud67/index.php”,“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/data/www/nextcloud67/apps/mail/lib/Service/MailTransmission.php”,“Line”:176,“Previous”:{“Exception”:“Horde_Mime_Exception”,“Message”:“Error connecting to SMTP server.”,“Code”:1,“Trace”:[{“file”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php”,“line”:479,“function”:“send”,“class”:“Horde_Mime_Part”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/lib/Service/MailTransmission.php”,“line”:174,“function”:“send”,“class”:“Horde_Mime_Mail”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/lib/Controller/AccountsController.php”,“line”:345,“function”:“sendMessage”,“class”:“OCA\Mail\Service\MailTransmission”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:170,“function”:“send”,“class”:“OCA\Mail\Controller\AccountsController”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/App.php”,“line”:137,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Routing/RouteActionHandler.php”,“line”:47,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“function”:“__invoke”,“class”:“OC\AppFramework\Routing\RouteActionHandler”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/Route/Router.php”,“line”:297,“function”:“call_user_func”},{“file”:“/data/www/nextcloud67/lib/base.php”,“line”:1010,“function”:“match”,“class”:“OC\Route\Router”,“type”:“->”},{“file”:“/data/www/nextcloud67/index.php”,“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php”,“Line”:1642,“Previous”:{“Exception”:“Horde_Mail_Exception”,“Message”:“Error connecting to SMTP server.”,“Code”:1,“Trace”:[{“file”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php”,“line”:1620,“function”:“send”,“class”:“Horde_Mail_Transport_Smtphorde”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php”,“line”:479,“function”:“send”,“class”:“Horde_Mime_Part”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/lib/Service/MailTransmission.php”,“line”:174,“function”:“send”,“class”:“Horde_Mime_Mail”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/lib/Controller/AccountsController.php”,“line”:345,“function”:“sendMessage”,“class”:“OCA\Mail\Service\MailTransmission”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:170,“function”:“send”,“class”:“OCA\Mail\Controller\AccountsController”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/App.php”,“line”:137,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Routing/RouteActionHandler.php”,“line”:47,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“function”:“__invoke”,“class”:“OC\AppFramework\Routing\RouteActionHandler”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/Route/Router.php”,“line”:297,“function”:“call_user_func”},{“file”:“/data/www/nextcloud67/lib/base.php”,“line”:1010,“function”:“match”,“class”:“OC\Route\Router”,“type”:“->”},{“file”:“/data/www/nextcloud67/index.php”,“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mail/Horde/Mail/Transport/Smtphorde.php”,“Line”:145,“Previous”:{“Exception”:“Horde_Smtp_Exception”,“Message”:“Error connecting to SMTP server.”,“Code”:1,“Trace”:[{“file”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Smtp/Horde/Smtp.php”,“line”:503,“function”:“login”,“class”:“Horde_Smtp”,“type”:“->”,“args”:[“*** sensitive parameters replaced ***”]},{“file”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mail/Horde/Mail/Transport/Smtphorde.php”,“line”:143,“function”:“send”,“class”:“Horde_Smtp”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Part.php”,“line”:1620,“function”:“send”,“class”:“Horde_Mail_Transport_Smtphorde”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Mail.php”,“line”:479,“function”:“send”,“class”:“Horde_Mime_Part”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/lib/Service/MailTransmission.php”,“line”:174,“function”:“send”,“class”:“Horde_Mime_Mail”,“type”:“->”},{“file”:“/data/www/nextcloud67/apps/mail/lib/Controller/AccountsController.php”,“line”:345,“function”:“sendMessage”,“class”:“OCA\Mail\Service\MailTransmission”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:170,“function”:“send”,“class”:“OCA\Mail\Controller\AccountsController”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Http/Dispatcher.php”,“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/App.php”,“line”:137,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/AppFramework/Routing/RouteActionHandler.php”,“line”:47,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“function”:“__invoke”,“class”:“OC\AppFramework\Routing\RouteActionHandler”,“type”:“->”},{“file”:“/data/www/nextcloud67/lib/private/Route/Router.php”,“line”:297,“function”:“call_user_func”},{“file”:“/data/www/nextcloud67/lib/base.php”,“line”:1010,“function”:“match”,“class”:“OC\Route\Router”,“type”:“->”},{“file”:“/data/www/nextcloud67/index.php”,“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/data/www/nextcloud67/apps/mail/vendor/pear-pear.horde.org/Horde_Smtp/Horde/Smtp.php”,“Line”:383}}},“CustomMessage”:“–”},“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0”,“version”:“19.0.5.2”,“id”:“5fbab9b2d589e”}

{“reqId”:“LBrgFIYpwA54Rmb1BZGv”,“level”:4,“time”:“2020-11-22T19:19:14+00:00”,“remoteAddr”:“77.183.70.112”,“user”:“USERNAMEXXXXX”,“app”:“mail”,“method”:“POST”,“url”:“/apps/mail/api/accounts/38/send”,“message”:“Sending mail failed: Could not send message: Error connecting to SMTP server.”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0”,“version”:“19.0.5.2”,“id”:“5fbab9b2d58c4”}

That’s the reason.

I found out that I have this problem SMTP: SSL error/Unable to connect

Go to settings
Enter mail server details
Click save
Check for errors in the setting popup
Verify no errors
Close and try to send email
Error: Request failed with status code 500

It is now 10 to 12. I have spent all morning with a constant stream of configuration errors and adjustments to a system that was working fine. And it just seems to be more and more common that something that worked no longer works. I spend more time fixing thing that were not broken than I do using this thing these days.

Outlook and Google are starting to look really attractive about now.

it’s sad to hear your experiences @Don_Robertson but at the same time you didn’t give us any workable information about your IMAP host nor the nextcloud server or anything else.

there are two options from there

  1. open a constructive topic with infos about your system and we try to help you
  2. use outlook/gmail and stop dumping your frustration on people of a community project