- π¨π¦Canada endless_wander
I am experiencing this issue and confirmed that SMTP module is up-to-date and code from commits in this thread are in my codebase. In debugging my particular instance of this issue, I found the MIMEMail module to be responsible.
If I output $mailerArr from SMTPMailSystem::mail() at line 707, my Sender address looks like this with the brackets. More debugging shows the Sender value is fine until line 432 where the return-path is setting the Sender email address:
case 'return-path': $mailer->Sender = $value; break;
In the MIMEMail config at /admin/config/system/mimemail, there is a field for the "Sender email address." Leaving this field blank when submitting the settings form will fill it in automatically with the site email address from Site settings. Whatever address I put into this MIMEMail config field is the one that gets set as Sender in the return-path case above. So, the <> characters appear to be coming from MIMEMail.
There is an active issue for MIMEMail module here -- https://www.drupal.org/project/mimemail/issues/3257799 π RfcComplianceException: RFC 2822 Needs work -- that seems to have the same confusion of responsibility as experiencing here. Maybe this is something in core? Our site recently updated to PHP 8.1 and that seems to be when the problems started so maybe PHP 8.1 is stricter as well? Just spitballing.
- πͺπΈSpain JavierGL
Here is a small patch to retrieve 'From' Drupal handling, this way it can be altered again if necessary