Nextcloud mail: AxiosError: Request failed with status code 400

NethServer Version: 8
Module: nextcloud

While setting up nextcloud, i set up mail and the test worked. After a few days (nothing installed), it doesn’t work anymore. AxiosError: Request failed with status code 400

All workarounds on the web didn’t help.

I use an external mail server (ionos)

log output: “POST /settings/admin/mailsettings/credentials HTTP/2.0” 400

Maybe this helps

No. It overwrites the config.php on every restart of nextcloud instance with the ddns hostname as mail_domain.

The mail notification settings are used and when those settings are changed, some of the mail settings in the config.php are overwritten.

Other settings like for example

'mail_smtptimeout' => 30,

are kept.

I have completely different settings that nextcloud displays by default in the basic settings than in my ns8 email notification settings. Can the ns8 mail settings be tested? Haven’t got an email since i set it up (ns7 anacron sent mails daily).

Is it about those settings… (which are set from the notification mail settings and are also found in config.php)

…or the Nextcloud Groupware mail app settings?

The ns8 mail notification settings are tested when they’re applied when you use “manual configuration”.
If “Use Mail application” is set, you may need to set the ionos smarthost (relay) in the mail app, see Mail — NS8 documentation

Alert notifications may need to be enabled in the Metrics settings, see Metrics and alerts — NS8 documentation

The entries in the config.php and what nextcloud displays, are completely different.

and further below:

grafik

the masked values are form the ionos server and correct.

in Nextcloud, i have

the hostname that’s always dispalyed in the sender address is my ddns hostname mydomain.ipv64.net and when i change it to the correct values of my ionos mailbox cloud@myionosdomain (and save it), it isn’t saved as the config file remains unchanged (with the above values which are correct). And i don’t use no-reply, as you can see above in the config.php snippet, i use cloud@myionosdomain. Even with the correct values i get the error, and when i log out and log in again, it’s reset to the values in the screenshot above (no-reply@mydomain.ipv64.net).

Which option did you set in the mail notification settings?

Also the cloud@myionosdomain mail address, i don’t use the mail app

1 Like

I could reproduce the issue.
The mail domain in the sender address is fetched from the Nextcloud FQDN and set via environment variables which override the config.php.
For example if the NC FQDN is nextcloud.domain.tld the mail domain is set to domain.tld.
For most cases that works because the NC domain is the same as the mail domain. I think adding a from address to the NC UI could be a solution…

As a workaround you could set the domain manually but the next update will overwrite it.

Edit discover-smarthost:

runagent -m nextcloud1 vi ../bin/discover-smarthost

Add

domain = "mywantedmaildomain.tld"

after

domain = config['host'].split('.',1)[1]

and adapt no-reply to your needs:

    print(f"MAIL_FROM_ADDRESS=no-reply", file=efp)

Restart Nextcloud.

1 Like

It works. I can live with this workaround. Thanks.

1 Like