2
2
namespace Geekdevs \SwiftMailer \Transport ;
3
3
4
4
use Swift_Events_EventListener ;
5
+ use Swift_Mime_SimpleMessage as Swift_Mime_Message ;
5
6
use Swift_Transport ;
6
7
use Swift_IoException ;
7
8
@@ -80,12 +81,12 @@ public function stop()
80
81
/**
81
82
* Sends the given message.
82
83
*
83
- * @param \ Swift_Mime_Message $message
84
+ * @param Swift_Mime_Message $message
84
85
* @param string[] $failedRecipients An array of failures by-reference
85
86
*
86
87
* @return int The number of sent emails
87
88
*/
88
- public function send (\ Swift_Mime_Message $ message , &$ failedRecipients = null )
89
+ public function send (Swift_Mime_Message $ message , &$ failedRecipients = null )
89
90
{
90
91
if ($ evt = $ this ->eventDispatcher ->createSendEvent ($ this , $ message )) {
91
92
$ this ->eventDispatcher ->dispatchEvent ($ evt , 'beforeSendPerformed ' );
@@ -111,12 +112,12 @@ public function send(\Swift_Mime_Message $message, &$failedRecipients = null)
111
112
}
112
113
113
114
/**
114
- * @param \ Swift_Mime_Message $message
115
+ * @param Swift_Mime_Message $message
115
116
* @param null $failedRecipients
116
117
* @return bool
117
118
* @throws Swift_IoException
118
119
*/
119
- protected function doSend (\ Swift_Mime_Message $ message , &$ failedRecipients = null )
120
+ protected function doSend (Swift_Mime_Message $ message , &$ failedRecipients = null )
120
121
{
121
122
$ body = $ message ->toString ();
122
123
$ fileName = $ this ->path .'/ ' .date ('Y-m-d H:i:s ' );
@@ -163,13 +164,29 @@ protected function getRandomString($count)
163
164
return $ ret ;
164
165
}
165
166
166
- /**
167
- * @inheritdoc
168
- *
169
- * @return bool TRUE if the transport is alive
170
- */
171
- public function ping ()
172
- {
173
- return true ;
174
- }
167
+ /**
168
+ * Check if this Transport mechanism is alive.
169
+ *
170
+ * If a Transport mechanism session is no longer functional, the method
171
+ * returns FALSE. It is the responsibility of the developer to handle this
172
+ * case and restart the Transport mechanism manually.
173
+ *
174
+ * @example
175
+ *
176
+ * if (!$transport->ping()) {
177
+ * $transport->stop();
178
+ * $transport->start();
179
+ * }
180
+ *
181
+ * The Transport mechanism will be started, if it is not already.
182
+ *
183
+ * It is undefined if the Transport mechanism attempts to restart as long as
184
+ * the return value reflects whether the mechanism is now functional.
185
+ *
186
+ * @return bool TRUE if the transport is alive
187
+ */
188
+ public function ping ()
189
+ {
190
+ return true ;
191
+ }
175
192
}
0 commit comments