Issue #3010067 : Option to put email addresses in To: instead of in Bcc:
(This merge request corresponds to the additional fix described & patch provided in https://www.drupal.org/project/content_moderation_notifications/issues/3010067#comment-13907635)
I've tested the patch in https://www.drupal.org/project/content_moderation_notifications/issues/3010067#comment-13676506, and everything functionally works as designed, with one scenario exception:
- The "Disable the site email address" option is checked, which will remove the initial "To" email header.
- The "To: instead of Bcc:" option is also checked, which will populate all recipient emails as the "To" email header.
This will cause a scenario where the "Bcc" header will be sent to the Drupal mailsystem, but with a value of an empty string, which will produce a fatal error, with the message PHPMailer\PHPMailer\Exception: Invalid address: (bcc): in PHPMailer\PHPMailer\PHPMailer->addOrEnqueueAnAddress() (line 1082 of /code/vendor/phpmailer/phpmailer/src/PHPMailer.php)
.
This branch makes a very slight modification to https://www.drupal.org/project/content_moderation_notifications/issues/3010067#comment-13676506: it will only populate the Bcc header if its final, prepared value is not an empty string.