From e96c159949ee756d45a20ba91457d3eca6c35a6d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Sep 2018 08:43:07 +0200 Subject: [PATCH] throw exception when sending on a transport that is not started --- lib/classes/Swift/Transport/AbstractSmtpTransport.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/classes/Swift/Transport/AbstractSmtpTransport.php b/lib/classes/Swift/Transport/AbstractSmtpTransport.php index 39b6e2135..d238ba97a 100644 --- a/lib/classes/Swift/Transport/AbstractSmtpTransport.php +++ b/lib/classes/Swift/Transport/AbstractSmtpTransport.php @@ -177,6 +177,10 @@ public function isStarted() */ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) { + if (!$this->started) { + $this->throwException(new Swift_TransportException('Cannot send messages when the transport is not started')); + } + $sent = 0; $failedRecipients = (array) $failedRecipients;