Can't get SMTP to work with mailbox.org account

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): 27.0.2
Operating system and version (eg, Ubuntu 20.04): replace me
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): replace me

The issue you are facing:

Can’t get SMTP to work with mailbox.org.

Symfony\Component\Mailer\Exception\TransportException: Failed to authenticate on SMTP server with username "xxx@mailbox.org" 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: UGFzc3dvcmQ6".". Authenticator "PLAIN" returned "Expected response code "235" but got code "535", with message "535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6".".

Using swaks on same instance I can send the email without any issues:

swaks --to yyy@gmail.com --from xxx@mailbox.org --server smtp.mailbox.org --port 587 --auth-user xxx@mailbox.org --auth-password 'zzz' --tls --header "Subject: Test Email" --body "This is a test email."

Here’s swaks log:

=== Trying smtp.mailbox.org:587...
=== Connected to smtp.mailbox.org.
<-  220 smtp1.mailbox.org ESMTP Postfix
 -> EHLO {hidden}
<-  250-smtp1.mailbox.org
<-  250-PIPELINING
<-  250-SIZE 143699726
<-  250-ETRN
<-  250-STARTTLS
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250-DSN
<-  250 CHUNKING
 -> STARTTLS
<-  220 2.0.0 Ready to start TLS
=== TLS started with cipher TLSv1.3:TLS_AES_256_GCM_SHA384:256
=== TLS no local certificate set
=== TLS peer DN="/CN=*.mailbox.org"
 ~> EHLO {hidden}
<~  250-smtp1.mailbox.org
<~  250-PIPELINING
<~  250-SIZE 143699726
<~  250-ETRN
<~  250-AUTH PLAIN LOGIN
<~  250-AUTH=PLAIN LOGIN
<~  250-ENHANCEDSTATUSCODES
<~  250-8BITMIME
<~  250-DSN
<~  250 CHUNKING
 ~> AUTH LOGIN
<~  334 VXNlcm5hbWU6
 ~> {hidden}
<~  334 UGFzc3dvcmQ6
 ~> {hidden}
<~  235 2.7.0 Authentication successful
 ~> MAIL FROM:<{hidden}@mailbox.org>
<~  250 2.1.0 Ok
 ~> RCPT TO:<{hidden}@gmail.com>
<~  250 2.1.5 Ok
 ~> DATA
<~  354 End data with <CR><LF>.<CR><LF>
 ~> Date: Sat, 02 Sep 2023 21:49:15 +0300
 ~> To: {hidden}@gmail.com
 ~> From: {hidden}@mailbox.org
 ~> Subject: Test Email
 ~> Message-Id: <20230902214915.149817@{hidden}>
 ~> X-Mailer: swaks vDEVRELEASE jetmore.org/john/code/swaks/
 ~> 
 ~> This is a test email.
 ~> 
 ~> 
 ~> .
<~  250 2.0.0 Ok: queued as AC21E1A57
 ~> QUIT
<~  221 2.0.0 Bye
=== Connection closed with remote host.

Here’s the config.php in nextcloud:

  'mail_smtpmode' => 'smtp',                                                     
  'mail_smtphost' => 'smtp.mailbox.org',                                         
  'mail_smtpport' => '587',                                                      
  'mail_smtpsecure' => 'tls',                                                    
  'mail_smtpauth' => true,                                                       
  'mail_smtpauthtype' => 'LOGIN',                                                
  'mail_smtpname' => 'xxx@mailbox.org',                               
  'mail_from_address' => 'xxx',                                       
  'mail_domain' => 'mailbox.org',                                                
  'mail_smtppassword' => 'zzz',                      

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

Steps to replicate it:

  1. Paste configuration from previous section (replace xxx with email and zzz with your password)
  2. Click on Send Email

The output of your Nextcloud log in Admin > Logging:

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/____:


Symfony\Component\Mailer\Exception\TransportException: Failed to authenticate on SMTP server with username "xxx@mailbox.org" 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: UGFzc3dvcmQ6".". Authenticator "PLAIN" returned "Expected response code "235" but got code "535", with message "535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6".".

/**

  • This depends on mail_smtpmode. Specify ssl when you are using SSL/TLS. Any other value will be ignored.
  • If the server advertises STARTTLS capabilities, they might be used, but they cannot be enforced by
  • this config option.
  • Defaults to '' (empty string)
    */

If it still fails, you might want to increase logging to debug:


/**
 * Enable SMTP class debugging.
 *
 * Defaults to ``false``
 */
'mail_smtpdebug' => false,

The string "UGFzc3dvcmQ6" is the Base64 encoded version of "Password:" followed by an empty password (just a period “.” in this case). In SMTP authentication messages, the password is usually Base64 encoded, so it looks cryptic at first glance.

The message “535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6” indicates that the server detected that the password is incorrect or empty and the authentication failed for this reason.

Double check your Password in your settings. Maybe it is quoted wrong?

If the username is invalid, this can also cause authentication to fail and the error message may vary depending on the SMTP server. However, it is common for the server to return a message stating that the user was not found in such cases. But that doesn’t have to be the case, so a typo in the ‘mail_smtpname’ can also have crept in.

I hope this helps,
much luck!

tried with ssl - still same thing. Also debug is already enabled - that’s why I can see the exception

(tls does not exist as an option and make the server asume it as an empty string, which enables STARTTLS)

If you tried it with the old ssl, you have to change the port to 465!

much luck

1 Like

The password is correct, however it has special characters like @!$ I hope there isn’t a bug somewhere related to those…

I can confirm, that at least ‘!’ and ‘$’ are no problem. I have them in use as well. I have no clue about ‘@’

Normaly it should not make any diference, since the password is transmitted base64 encoded. But since it is handled by the Symfony mailer first, and there problems could occur. You could try to change the password to a string without ‘@’ to find that out

Important is, to enclose your password between single quotes in the config.php.

much luck!

I can’t just switch the password as mailbox.org doesn’t support app passwords and this is my main password connected to multiple services.

But everything looks set with proper credentials and single quotes
Screenshot from 2023-09-04 18-07-02

True to the motto: No you have, yes you can get, this is just a desperate attempt to find a solution, but I’ve had success in a similar case that I’ve escaped the corresponding special character in the password, so instead of '@' use '\@'.

Little hope, but good luck!

I’d used a dedicated mail account for this purpose.

As other services work better, I switched to SSMTP after some initial problems with the internal mailer. PHP just passes all the mails and with SSMTP you can configure more details and have more logging (at that time, from NC side that part has improved a bit).

Using SSL with Port 465 was the solution for me, although I use Port 587 in every other client. Thanks, @ernolf :pray: