Problem AxiosError: Request failed with status code 400

I would like to set up my email address for password change requests on NextCloud. My email address is @yahoo.it, so I’ve set up the following:

Sending method SMTP
Encryption. none/STARTTLS
Sender address myaddress@yahoo.it
Server address smtp.mail.yahoo.com: 465

If I click on: Test and verify email settings I receive: AxiosError: Request failed with status code 400
I also tried setting 587, 993 and 995 as ports but I always get the same error.. could you help me?

This is what I see from my config file:

'default_phone_region' => 'IT',

'theme' => '',

'loglevel' => 2,

'maintenance' => false,

'maintenance_window_start' => 1,

'mail_smtpmode' => 'smtp',

'mail_sendmailmode' => 'smtp',

'mail_from_address' => 'myaddress',

'mail_domain' => 'yahoo.it',

'mail_smtphost' => 'smtp.mail.yahoo.com',

'mail_smtpport' => '465', 

I have the same issue. Others have the same issue. There seems to be no clear answer - and different people who have the issue have taken different paths.
Things I’ve seen:
Install the Mail app.
Make sure your account has an email set.
The problem is that this is caused by javascript - admin.js - and the axious error is browser side - the actual MailHandler that does the test is NEVER getting fired - the error is entirely browser side - and I have no idea why. Clearly - nobody else does or nobody cares. This error was introduced in the last year in the 30.x branch.

I was getting this AxiosError error on a new AIO instance. On a hunch I checked my Admin profile and realized I didn’t have an email address set. After adding an address, the test email was sent without error. Hope this helps someone.

I finally got it to work. Like others mentioned I set the email of the Admin profile (in my case same as for smtp), but the final trick was specific for Yahoo - you need an App password, not your normal password!

I found the steps here: https://instantly.ai/blog/yahoo-smtp-settings/

  • log on via web browser (my case yahoo.com)
  • go to your profile (Account info)
  • go to tab Security
  • under “External Connections” select “App passwords”
  • generate an app password, I described my app as “nextcloud-server” → generates random password
  • enter this password in nextcloud AIO “Basic settings” → send email works

Other settings as described above:

  • Send mode SMTP
  • Encryption None/STARTTLS
  • From address “myname” @ “yahoo.com
  • server address smtp.mail.yahoo.com : 587
  • authentication required yes
  • credentials “myname@yahoo.com” with password generated above

Finally work’s!!!

thx

1 Like

I had uninstalled the Mail app. After that, the error occurred for the first time. After reinstalling the Mail app, the error was fixed again.

I had the same problem and after extensive troubleshooting, no results. I copied the mail parameters from " Configuration Parameters — Nextcloud latest Administration Manual latest documentation " into config.php 1:1. I Removed all old mail parameters. Then I re-entered the parameters in the Nextcloud UI. The config.php then looked like this:

‘mail_domain’ => ‘***.**’,

‘mail_from_address’ => ‘***’,

‘mail_smtpdebug’ => true,

‘mail_smtpmode’ => ‘smtp’,

‘mail_smtphost’ => ‘***.**’, //same as mail_domain

‘mail_smtpport’ => ‘465’,

‘mail_smtptimeout’ => 10,

‘mail_smtpsecure’ => ‘ssl’,

‘mail_template_class’ => ‘\\OC\\Mail\\EMailTemplate’,

‘mail_send_plaintext_only’ => false,

‘mail_smtpstreamoptions’ =>

array (

),

‘mail_sendmailmode’ => ‘smtp’,

‘loglevel’ => 2,

‘mail_smtpauth’ => true,

‘mail_smtpname’ => ‘***@***.**’,

‘mail_smtppassword’ => ‘***’,

The test email was then sent successfully!

Maybe the original nextcloud 32 config.php is already incomplete in the email parameters, even if it was filled correctly in the Nextcloud UI. This Nextcloud was installed via Plesk on an Ubuntu Server with Postfix.

In an older Nextcloud version, the admin user did not have an email address stored, but the error messages are so bad that they do not communicate this. I hope that in the future, a Nextcloud developer will implement better error handling specifically for email setup. This would help many Nextcloud users.

1 Like