Authenticator \"LOGIN\" returned \"Expected response code \"235\" but got code \"535\", with message \"535 5.7.8 Error: authentication failed: (reason unavailable)\"

Hi everyone,

I hope you are well and I look forward to receiving your help.

I am having a problem testing the email settings under Basic Settings in my Nextcloud admin panel.

I have encountered several similar issues here, but nothing solves my problem.

When I enable mail_smtpdebug and test my configuration I get the following log:

{“reqId”:“IvFKMquLElQBt968kFGN”,“level”:0,“time”:“2024-12-30T10:36:33+00:00”,“remoteAddr”:“192.168.x.y”,“user”:“username”,“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/131.0.0.0 Safari/537.36 Edg/131.0.0.0”,“version”:“30.0.4.1”,“data”:}
{“reqId”:“IvFKMquLElQBt968kFGN”,“level”:0,“time”:“2024-12-30T10:36:45+00:00”,“remoteAddr”:“192.168.x.y”,“user”:“username”,“app”:“core”,“method”:“POST”,“url”:“/settings/admin/mailtest”,“message”:“Sending mail to "Array\n(\n [username@domain.com] => Testuser\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/131.0.0.0 Safari/537.36 Edg/131.0.0.0”,“version”:“30.0.4.1”,“exception”:{“Exception”:“Symfony\Component\Mailer\Exception\TransportException”,“Message”:“Failed to authenticate on SMTP server with username "username@domain.com" using the following authenticators: "LOGIN", "PLAIN". Authenticator "LOGIN" returned "Expected response code "235" but got code "535", with message "535 5.7.8 Error: authentication failed: (reason unavailable)".". Authenticator "PLAIN" returned "Expected response code "235" but got code "535", with message "535 5.7.8 Error: authentication failed: (reason unavailable)".".”,“Code”:535,“Trace”:[{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/EsmtpTransport.php”,“line”:161,“function”:“handleAuth”,“class”:“Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/EsmtpTransport.php”,“line”:118,“function”:“doEhloCommand”,“class”:“Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php”,“line”:254,“function”:“executeCommand”,“class”:“Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php”,“line”:277,“function”:“doHeloCommand”,“class”:“Symfony\Component\Mailer\Transport\Smtp\SmtpTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php”,“line”:209,“function”:“start”,“class”:“Symfony\Component\Mailer\Transport\Smtp\SmtpTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/AbstractTransport.php”,“line”:69,“function”:“doSend”,“class”:“Symfony\Component\Mailer\Transport\Smtp\SmtpTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php”,“line”:137,“function”:“send”,“class”:“Symfony\Component\Mailer\Transport\AbstractTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/3rdparty/symfony/mailer/Mailer.php”,“line”:42,“function”:“send”,“class”:“Symfony\Component\Mailer\Transport\Smtp\SmtpTransport”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/Mail/Mailer.php”,“line”:205,“function”:“send”,“class”:“Symfony\Component\Mailer\Mailer”,“type”:“->”},{“file”:“/var/www/nextcloud/apps/settings/lib/Controller/MailSettingsController.php”,“line”:148,“function”:“send”,“class”:“OC\Mail\Mailer”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:208,“function”:“sendTestMail”,“class”:“OCA\Settings\Controller\MailSettingsController”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:114,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/AppFramework/App.php”,“line”:161,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/Route/Router.php”,“line”:302,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“file”:“/var/www/nextcloud/lib/base.php”,“line”:1003,“function”:“match”,“class”:“OC\Route\Router”,“type”:“->”},{“file”:“/var/www/nextcloud/index.php”,“line”:24,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/var/www/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/EsmtpTransport.php”,“Line”:226,“message”:“Sending mail to "Array\n(\n [username@domain.com] => Testuser\n)\n" with subject "Email setting test" failed”,“exception”:{},“CustomMessage”:“Sending mail to "Array\n(\n [username@domain.com] => Testuser\n)\n" with subject "Email setting test" failed”}}

I have tried

  • Changing the port and protocol from 465/ssl to 587/tls.
  • Changing the user (mail_smtpname) without the domain.
  • Using the password (mail_smtppassword) in base64 format.
  • Changing the username and password.

I have checked that the username and password are correct in all cases.

This is my configuration:

{
“system”: {
“instanceid”: “REMOVED SENSITIVE VALUE”,
“passwordsalt”: “REMOVED SENSITIVE VALUE”,
“secret”: “REMOVED SENSITIVE VALUE”,
“trusted_domains”: [
“mqnextcloud”
],
“datadirectory”: “REMOVED SENSITIVE VALUE”,
“dbtype”: “mysql”,
“version”: “30.0.4.1”,
“overwrite.cli.url”: “https://mqnextcloud”,
“htaccess.RewriteBase”: “/”,
“dbname”: “REMOVED SENSITIVE VALUE”,
“dbhost”: “REMOVED SENSITIVE VALUE”,
“dbport”: “”,
“dbtableprefix”: “oc_”,
“mysql.utf8mb4”: true,
“dbuser”: “REMOVED SENSITIVE VALUE”,
“dbpassword”: “REMOVED SENSITIVE VALUE”,
“installed”: true,
“updater.release.channel”: “stable”,
“maintenance”: false,
“loglevel”: 2,
“app_install_overwrite”: [
“files_antivirus”
],
“maintenance_window_start”: 1,
“theme”: “”,
“memcache.locking”: “OC\Memcache\Redis”,
“memcache.local”: “OC\Memcache\APCu”,
“memcache.distributed”: “OC\Memcache\Redis”,
“redis”: {
“host”: “REMOVED SENSITIVE VALUE”,
“port”: “6379”
},
“enable_previews”: false,
“LdapProviderFactory”: “OCA\User_LDAP\LDAPProviderFactory”,
“app.mail.verify-tls-peer”: false,
“mail_smtpmode”: “smtp”,
“mail_sendmailmode”: “smtp”,
“mail_from_address”: “REMOVED SENSITIVE VALUE”,
“mail_domain”: “REMOVED SENSITIVE VALUE”,
“mail_smtphost”: “REMOVED SENSITIVE VALUE”,
“mail_smtpport”: “465”,
“mail_smtpsecure”: “ssl”,
“mail_smtpstreamoptions”: {
“ssl”: {
“allow_self_signed”: true,
“verify_peer”: false,
“verify_peer_name”: false
}
},
“mail_smtpauth”: 1,
“mail_smtpname”: “REMOVED SENSITIVE VALUE”,
“mail_smtppassword”: “REMOVED SENSITIVE VALUE”,
“mail_smtpdebug”: false
}
}

On the other hand, my original SMTP configuration works in Nextcloud Mail App.

Do you have any idea?

Thanks in advance!

Hello,

535 5.7.8 Error: authentication failed: (reason unavailable)

Seems like you’re trying to match encryption type with the destination, have tried different credential formats and passwords.

What service are you trying to send email through?
Will the service you are attempting to send to allow your traffic or do you need to whitelist the source or use a relay service (like Brevo, etc.)?

Is your firewall/proxy allowing traffic from the source to the destination at both the host and off host firewall levels? if not the “test and verify email settings” send mail test will fail…