Using BCC or CC in "Send email to user" within Campaign Builder results in emails not being sent and a RFC2822 error in mautic-prod logs, as well as error on front end

Your software
My Mautic version is: 5.0.4
My PHP version is: 8.1.27
My Database type and version is: 10.3.39-MariaDB-1:10.3.39+maria

Your problem

When using a “Send email to user” block in the campaign editor, entering in any email into either the CC or BCC fields results in an error that prevents the email from sending.

It took me ages to find that it wasn’t that the email address I had entered into the BCC or CC field was the issue, but that the functionality simply does not work.

These errors are showing in the log:

The following is shown on the front end underneath the History > Event Name column within a Contact’s details:

Delivery | Email | notify-new-lead-general-1.3 / Lead Processor | Debug <i data-toggle="tooltip" title="This event encountered an error during the last attempt to process." class="fa fa-warning text-danger"></i>](https://example.com/s/campaigns/view/26)

image

The following log appears in the respective /var/logs/mautic_prod-YYYY-MM-DD.php file:

[2024-05-08T20:41:15.110787+00:00] mautic.ERROR: [MAIL ERROR] Email "0" does not comply with addr-spec of RFC 2822. (bcc) {"exception":"[object] (Symfony\\Component\\Mime\\Exception\\RfcComplianceException(code: 0): Email \"0\" does not comply with addr-spec of RFC 2822. at /var/www/example.com/vendor/symfony/mime/Address.php:56)"} {"hostname":"known-01-linode-de-ashe","pid":3503842}

Steps I have tried to fix the problem:
I have tried numerous combinations of email addresses, TLDs, comma seperated emails, etc, with the same result. The only way that I can get similar functionality to CC or BCC to work is to use the To: field with comma seperated email addresses.


This works


This does not


Nor does this