- Issue created by @zengenuity
- Status changed to Needs review
over 1 year ago 7:57pm 15 August 2023 - last update
over 1 year ago Composer config failure
Sending emails with BCC recipients does not work on Drupal 8. The issue is caused by this commit: https://git.drupalcode.org/project/smtp/-/commit/a46b2f8a0d0a8e9cfcbeb85...
An error was added in BCC handling for older Drupal versions. Instead of
<?php
// @todo remove when dropping support for D8 and 9.2.
if ($this->mimeTypeGuesser instanceof MimeTypeGuesserInterface) {
// phpcs:ignore
$mailer->AddBCC($bcc_comp['email'], (new UnstructuredHeader('BCC', $bcc_comp['name']))->getBodyAsString());
}
else {
// @phpstan-ignore-next-line
$mailer->FromName = Unicode::mimeHeaderEncode($from_name);
}
It should be:
<?php
// @todo remove when dropping support for D8 and 9.2.
if ($this->mimeTypeGuesser instanceof MimeTypeGuesserInterface) {
// phpcs:ignore
$mailer->AddBCC($bcc_comp['email'], (new UnstructuredHeader('BCC', $bcc_comp['name']))->getBodyAsString());
}
else {
// @phpstan-ignore-next-line
$mailer->addBCC($bcc_comp['email'], $bcc_comp['name']);
}
Install module on Drupal 8.9.x and attempt to send an email with a BCC recipient.
Patch coming to make the code change.
Needs review
1.2
Code