Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] Yet another attempt to fix Swift Mailer related SSL failures (Issue #4573) #13583

Merged
merged 8 commits into from
Jun 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just call "forceReconnection" here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taylorotwell the problem is that stop() may throw an exception, but even if it'll be catched - it won't reset transport. You need to call either reset(), either stop() > start().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because calling "forceReconnection" would not make sense form a semantic point of view.

}
} elseif (isset($this->logger)) {
$this->logMessage($message);
}
Expand Down