Receipt mail BCC not working

Created on 19 January 2024, about 1 year ago
Updated 22 January 2024, about 1 year ago

When setting a value in the field "send receipt copy to..." in my order type configuration, it's successfully saved. Then, when I make an order, the customer receives the receipt and there are no errors, but somehow, the address specified in the copy field doesn't receive the receipt. I noticed that when I do a dd($bcc); at line 63 of the file commerce/modules/order/src/Mail/OrderReceiptMail.php, it returns NULL. To pinpoint the issue, I went to the file commerce/modules/order/src/EventSubscriber/OrderReceiptSubscriber.php. I made a dd($order_type->getReceiptBcc());, the value is correctly set. I don't really know what is happening between the execution of these two files, but something is setting the "$bcc" variable's value to NULL. It may be another contrib module installed on the site or one of our custom modules. I also noticed that when the "$params" array in the file "OrderReceiptMail.php" contains a key 'bcc', sometimes, the copy isn't sent.

For a workaround to these issues, I made this patch that checks if the variable "$bcc" in the file "OrderReceiptMail.php" is null. If it is, it'll be re-set to the configured value in order type configuration. I also replaced the key 'bcc' by 'cc' in "$params" array.

If you're facing a similar issue, try this patch and let me know if it does the trick :)

🐛 Bug report
Status

Closed: cannot reproduce

Version

2.33

Component

Order

Created by

🇨🇭Switzerland zilloww

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @zilloww
  • Status changed to Closed: cannot reproduce about 1 year ago
  • 🇮🇱Israel jsacksick

    Perhaps the issue is due to the module you're using for sending emails? Are you using Symfony mailer? Might be a Symfony mailer bug then... Your fix doesn't look correct.

  • @Zilloww - thanks, the patch worked for me. I am using Drupal 10.3.0.

    @jsacksick - yes, I am using Symfony mailer...

Production build 0.71.5 2024