Skip to content

Commit

Permalink
[5.1] Yet another attempt to fix Swift Mailer related SSL failures (I…
Browse files Browse the repository at this point in the history
…ssue #4573) (#13583)

* Issue #4573
    - close mailer connection after sending message
    - fix return statements and related phpdoc

* Minor
    Fixed code style according to StyleCI

* Revert return type fixes

* Minor
    fixed code style according to StyleCI

* Minor
    StyleCI still not happy... :-(

* - Reverted removal of Mailer::forceReconnection() method
- wrap try-finally around swift->send(); transport->stop();

* Minor: remove temporary result variable

* Use private field instead of public getter for swift mailer
  • Loading branch information
schanzel authored and taylorotwell committed Jun 11, 2016
1 parent 6784875 commit bb59455
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ public function plain($view, array $data, $callback)
*/
public function send($view, array $data, $callback)
{
$this->forceReconnection();

// First we need to parse the view, which could either be a string or an array
// containing both an HTML and plain text versions of the view which should
// be used when sending an e-mail. We will extract both of them out here.
Expand Down Expand Up @@ -392,7 +390,11 @@ protected function sendSwiftMessage($message)
}

if (! $this->pretending) {
return $this->swift->send($message, $this->failedRecipients);
try {
return $this->swift->send($message, $this->failedRecipients);
} finally {
$this->swift->getTransport()->stop();
}
} elseif (isset($this->logger)) {
$this->logMessage($message);
}
Expand Down

0 comments on commit bb59455

Please sign in to comment.