Run the following code:
$mailer = Factory::getContainer()->get(MailerFactoryInterface::class)->createMailer();
$mailer->setSender('test@example.com');
$mailer->addRecipient('me@example.com');
$mailer->setSubject('Test');
$mailer->setBody('Test body');
$mailer->send();
The From header in the mail is test@example.com.
The From header in the mail is the global from option from the global configuration.
Bug is since #46431 got merged and shipped with 5.4.2.
If other extension developers come across this issue, the fix is:
if ($mailer instanceof Mail) {
$mailer->Sender = $mailer->From;
}
| Labels |
Added:
No Code Attached Yet
|
||
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-01-08 17:13:53 |
| Closed_By | ⇒ | alikon |
I'm not sure how to fix this without reverting the original pr and not introduce another bc break.