Skip to content

Commit

Permalink
extract method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 10, 2017
1 parent dc2b82a commit 6c5f3a4
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Illuminate/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ public function send($view, array $data = [], $callback = null)

$this->sendSwiftMessage($message->getSwiftMessage());

if ($this->events) {
$this->events->dispatch(new Events\MessageSent($message->getSwiftMessage()));
}
$this->dispatchSentEvent($message);
}

/**
Expand Down Expand Up @@ -459,6 +457,21 @@ protected function shouldSendMessage($message)
) !== false;
}

/**
* Dispatch the message sent event.
*
* @param \Illuminate\Mail\Message $message
* @return void
*/
protected function dispatchSentEvent($message)
{
if ($this->events) {
$this->events->dispatch(
new Events\MessageSent($message->getSwiftMessage())
);
}
}

/**
* Force the transport to re-connect.
*
Expand Down

0 comments on commit 6c5f3a4

Please sign in to comment.