Skip to content

Commit

Permalink
SmtpSender: Better handling of exceptions thrown when building the me…
Browse files Browse the repository at this point in the history
…ssage (#43)
  • Loading branch information
Andrewsville authored and dg committed Jul 23, 2017
1 parent bf2425c commit cd1c070
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Mail/SmtpMailer.php
Expand Up @@ -73,7 +73,9 @@ public function __construct(array $options = [])
*/
public function send(Message $mail)
{
$mail = clone $mail;
$tmp = clone $mail;
$tmp->setHeader('Bcc', null);
$data = $tmp->generateMessage();

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

$mail->setHeader('Bcc', null);
$data = $mail->generateMessage();
$this->write('DATA', 354);
$data = preg_replace('#^\.#m', '..', $data);
$this->write($data);
Expand Down

0 comments on commit cd1c070

Please sign in to comment.