Email does not comply with addr-spec of RFC 2822

Created on 25 November 2023, 11 months ago
Updated 26 July 2024, 3 months ago

Problem/Motivation

I don't understand this error: Symfony\Component\Mime\Exception\RfcComplianceException: Email "<info@kunstbehoudgroningen.nl>" does not comply with addr-spec of RFC 2822. in Symfony\Component\Mime\Address->__construct() (line 54 of /xxx/drupal/vendor/symfony/mime/Address.php).
info@kunstbehoudgroningen.nl is, in my opinion, a valid email address.

πŸ’¬ Support request
Status

Active

Version

11.0 πŸ”₯

Component
MailΒ  β†’

Last updated 15 days ago

No maintainer
Created by

πŸ‡³πŸ‡±Netherlands promes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @promes
  • πŸ‡³πŸ‡±Netherlands promes
  • Can you debug to see which validator is acting on the address?

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    If the email contains <> it should also have a name, e.g Bob<bob@example.com>

  • πŸ‡³πŸ‡±Netherlands promes

    Thanks for the quick response.
    The validator is Egulias\EmailValidator\EmailValidator.
    I see that it indeed tries to send a <mailaddress> once with and once without a name.
    For verification, I sent a mail through another website and there I got no error message. Difference: the use of mimemail. I will report the error to that module.

  • That is the library, yes. But I was asking which of MessageIDValidation or RFCValidation is acting on that message. I sent a link to a line of code as a reference.

  • πŸ‡³πŸ‡±Netherlands promes

    It is the MessageIDValidation

  • πŸ‡³πŸ‡±Netherlands promes

    For your information, as a test, I modified the code with an extra line: if (empty($name)) $name = 'info@kunstbehoudgroningen.nl'; before $this->name = trim...
    The error message remains the same.

  • πŸ‡ΊπŸ‡¦Ukraine tibezh

    I had the same issue on last version (10x) install, to solve it, apply "Email address" on the Basic site settings page (/admin/config/system/site-information).
    But, why hasn't the email been applied after the Drupal install - this is a need to investigate I think.

  • πŸ‡³πŸ‡±Netherlands helmo

    The < and > chars are the problem here.

    A workaround is adding this line:
    $this->address = trim(str_replace(["<", ">"], '', $address));

    Still not sure where these are added though, the users_field_data db tables does not contain them.

Production build 0.71.5 2024