@@ 298-311 (lines=14) @@ | ||
295 | /** |
|
296 | * Connect to the MTA if not already connected |
|
297 | */ |
|
298 | public function connect() |
|
299 | { |
|
300 | if (!$this->isConnected()) |
|
301 | { |
|
302 | try { |
|
303 | $this->swift->connect(); |
|
304 | return true; |
|
305 | } catch (Swift_ConnectionException $e) { |
|
306 | $this->failed = true; |
|
307 | $this->setError("Swift failed to run the connection process:<br />" . $e->getMessage()); |
|
308 | } |
|
309 | } |
|
310 | return false; |
|
311 | } |
|
312 | /** |
|
313 | * Perform the SMTP greeting process (don't do this unless you understand why you're doing it) |
|
314 | */ |
|
@@ 323-335 (lines=13) @@ | ||
320 | * Close the connection to the MTA |
|
321 | * @return boolean |
|
322 | */ |
|
323 | public function close() |
|
324 | { |
|
325 | if ($this->isConnected()) |
|
326 | { |
|
327 | try { |
|
328 | $this->swift->disconnect(); |
|
329 | return true; |
|
330 | } catch (Swift_ConnectionException $e) { |
|
331 | $this->setError("Disconnect failed:<br />" . $e->getMessage()); |
|
332 | } |
|
333 | } |
|
334 | return false; |
|
335 | } |
|
336 | /** |
|
337 | * Send a command to Swift and get a response |
|
338 | * @param string The command to send (leave of CRLF) |