Skip to content

Commit 2246d47

Browse files
Andrewsvilledg
authored andcommitted
SmtpSender: Better handling of exceptions thrown when building the message (#43)
1 parent de2875a commit 2246d47

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Mail/SmtpMailer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ public function __construct(array $options = [])
7474
*/
7575
public function send(Message $mail): void
7676
{
77-
$mail = clone $mail;
77+
$tmp = clone $mail;
78+
$tmp->setHeader('Bcc', null);
79+
$data = $tmp->generateMessage();
7880

7981
try {
8082
if (!$this->connection) {
@@ -95,8 +97,6 @@ public function send(Message $mail): void
9597
$this->write("RCPT TO:<$email>", [250, 251]);
9698
}
9799

98-
$mail->setHeader('Bcc', null);
99-
$data = $mail->generateMessage();
100100
$this->write('DATA', 354);
101101
$data = preg_replace('#^\.#m', '..', $data);
102102
$this->write($data);

0 commit comments

Comments
 (0)