Email settings gets wrong sender domain, fails due to not RFC compliant

Hi,

i have a problem with setting the proper email settings in the Admin UI. My nextcloud installation is reachable at nextcloud.mydomain.tld, so i have configured it to send mails as noreply@nextcloud.mydoman.tld. I entered the credentials for my SMTP server, and tried to send a test email. This creates an error:

A problem occurred while sending the email. Please revise your settings. (Error: Address in mailbox given [noreply@nextcloud.mydomain.tld@localhost.localdomain] does not comply with RFC 2822, 3.6.2.

I have installed nextcloud via docker (via the official nextcloud image). I have also set the MAIL_FROM_ADDRESS environment variable to noreply@nextcloud.mydomain.tld, but with no success. Where is my mistake?

(Obvious disclaimer: mydomain.tld is not my real domain, i just have obfuscated it here for the sake of privacy).

Hi there, I realize it has been awhile since this was asked, but I had the same trouble myself.

I was able to get past this error by setting MAIL_FROM_ADDRESS to just noreply and then set MAIL_DOMAIN to nextcloud.mydomain.tld.

It turns out the MAIL_FROM_ADDRESS is not real well named, as it is not looking for the full address, but just the user/name portion of the address.

Also, I haven’t fully tested, but simply changing the address fields in the NextCloud Settings page didn’t seem to resolve it, I had to change the envvar in my dockerfile and rebuild. I don’t know if that is actually necessary (I hope not!) but it is worth trying, if you don’t have luck the other way.

HTH,

J

I end up stuck with the same problem, wanted to activate email for new users… so when setting up the email server:

config:
‘mail_from_address’ => ’ no-reply’,
‘mail_smtpmode’ => ‘smtp’,
‘mail_smtpsecure’ => ‘tls’,
‘mail_domain’ => ‘cloud.domain.tld’,
‘mail_smtpauth’ => 1,
‘mail_smtphost’ => ‘smtp.domain.tld’,
‘mail_smtpname’ => ‘user’,
‘mail_smtppassword’ => ‘xxx’,
‘mail_smtpport’ => ‘465’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_smtpdebug’ => true,

reply:

Beim Senden der E-Mail ist ein Problem aufgetreten. Bitte überprüfe Deine Einstellungen. (Fehler: Address in mailbox given [ no-reply@localhost.localdomain] does not comply with RFC 2822, 3.6.2.)

translated:

During sending the email a problem appeared. Please check your settings. (Error: Adress in mailbox given [ no-replay@localhost.localdomain] does not comply with RFC 2822, 3.6.2.)

It seems like the mail_domain is ignored. I’m on a shared hosting, could it be some standard php variable is used that is overridden by the system? version is 18.0.2

There is a single space in front of no-reply. That’s not allowed.

1 Like

DAMN! Got me! Thank you very much, just wondering why the form input does not strip nor check the string.