[SOLVED] Neos/swiftmailer: Address in mailbox given [] does not comply with RFC 2822, 3.6.2

Good morning,

I get an exception Address in mailbox given [] does not comply with RFC 2822, 3.6.2. when I test my contact form. The email address complies definitely RFC.

exceptions log says
Exception in line 261 of /var/www/html/vendor/Packages/Libraries/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php: Address in mailbox given [] does not comply with RFC 2822, 3.6.2.

Obvously these function causes the error:

private function _assertValidAddress($address)
    {
        if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D',
            $address)) {
            throw new Swift_RfcComplianceException(
                'Address in mailbox given ['.$address.
                '] does not comply with RFC 2822, 3.6.2.'
                );
        }
    }

EDIT: Error was, that I didn’t took into account, that I changed the identifier-name of one of the renderables. I had to change the name in the options of my custom finisher, too, of course :sleeping:

How to resolve this issue let me know

Hallo Kishore DR,

as I wrote I changed the identifier-name of one of the renderables. I worked with a custom finisher, so in this custom finisher I had to change the name, too.

The fully RFC 822 compliant regex is inefficient and obscure for validate email address because of its length. Fortunately, RFC 822 was superseded twice and the current specification for email addresses is RFC 5322. RFC 5322 leads to a regex that can be understood if studied for a few minutes and is efficient enough for actual use.

If you use HTML5, use this code:

<input type="email" name="email" required placeholder="Enter a valid email address">