Skip to content

Commit cd1c070

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

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
@@ -73,7 +73,9 @@ public function __construct(array $options = [])
7373
*/
7474
public function send(Message $mail)
7575
{
76-
$mail = clone $mail;
76+
$tmp = clone $mail;
77+
$tmp->setHeader('Bcc', null);
78+
$data = $tmp->generateMessage();
7779

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

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

0 commit comments

Comments
 (0)