When configuring NextCloud to use the SMTP email server for delivering notifications, password resets, link invitations, etc.. You might be unlucky enough to come across the Error 554 ‘no valid recipients’. So I’ll go over the actual configuration for NextCloud 19 and show you why this error occurs, even if all your email settings and configuration are correct.
Working Email Account
Well of course the first thing you should be checking out is if the email account you’re trying to setup in Nextcloud works. Test and check that it’s working, that you can receive email. If all is well and good you’re probably starting to pull your hair out!
Working Configuration File
We’ll pretend here that we’re trying to configure next cloud to use firstname.lastname@example.org. Here’s what the config file should look like.
Note that a number of helpful posts online about 554 errors deal with the from address not being set as email@example.com. In our case, it’s understood and this is the correct way of doing it. If you’re still having problems with Error 554 ‘no valid recipients’ after having a perfect config file as above read one.
Alternative Configuration Files
These settings are supposed to be mapped to config.php. This file is well worth checking as it’s actually what’s being digested by the system. You’ll find the location of the config file for NextCloud stored here:
Make sure your settings are matching watch you are expecting and that there isn’t any syntax issues being missed.
'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => 'ssl', 'mail_sendmailmode' => 'smtp', 'maintenance' => false, 'mail_smtpname' => 'firstname.lastname@example.org', 'mail_smtppassword' => '<PASSWORD>', 'mail_domain' => 'example.com', 'mail_from_address' => 'system', 'mail_smtphost' => 'mail.example.com', 'mail_smtpauth' => 1, 'mail_smtpport' => '465', 'mail_smtpauthtype' => 'LOGIN', 'app_install_overwrite' => array ( 0 => 'dashboardcharts', ), );
If you’ve checked this and you know your settings are all correct, don’t worry…
Less Known Resolution [RESOLVED]
Ok, ok, I know you’ve been trawling the internet for hours seeking every possible post that might resemble your issue. Yet came up empty-handed and hasn’t helped you get a working SMTP interface from NextCloud 19.
I noticed this by tailing my mail logs:
tail -f /var/log/maillog
Jul 9 05:15:13 akiko postfix/smtpd: connect from akiko.smallbyte.tech[18.104.22.168] Jul 9 05:15:13 akiko postfix/smtpd: NOQUEUE: reject: RCPT from akiko.smallbyte.tech[22.214.171.124]: 550 5.1.1 <email@example.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<firstname.lastname@example.org> to=<email@example.com> proto=ESMTP helo=<portal.example.com> Jul 9 05:15:13 akiko postfix/smtpd: disconnect from akiko.smallbyte.tech[126.96.36.199] ehlo=1 auth=1 mail=1 rcpt=0/1 data=0/1 quit=1 commands=4/6
Wait!? firstname.lastname@example.org? We’re using email@example.com!
As a result, check the admin user for NextCloud and see what’s listed as the email address. Believe it or not the sending address for the mail configuration MUST match the email address listed for the Admin account. (Is this a bug?!)
Secondly, I’ve not tested this with alternative admin users and it might be dependant on the admin user account that’s logged in. However, this something to be aware of and could also be an issue for you.
Since I came across nothing that offered this warning online I thought I would write up this post to help you if this is your problem.