We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fd8c21 commit a1bc25dCopy full SHA for a1bc25d
1 file changed
src/Service/MailService.php
@@ -70,6 +70,12 @@ public function send(): ResultInterface
70
//trigger error event
71
$this->getEventManager()->triggerEvent($this->createMailEvent(MailEvent::EVENT_MAIL_SEND_ERROR, $result));
72
throw new MailException($result->getMessage());
73
+ } finally {
74
+ // Reset the Symfony Message body after every send attempt (success or failure).
75
+ // attachFiles() embeds DataParts into Message::$body; without this reset those
76
+ // DataParts survive a failed send and get wrapped into the next email's body,
77
+ // causing attachments from a failed send to leak into subsequent emails.
78
+ $this->getMessage()->setBody(null);
79
}
80
81
if ($result->isValid()) {
0 commit comments