Transport.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Sends Messages via an abstract Transport subsystem.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. interface Swift_Transport
  15. {
  16. /**
  17. * Test if this Transport mechanism has started.
  18. *
  19. * @return bool
  20. */
  21. public function isStarted();
  22. /**
  23. * Start this Transport mechanism.
  24. */
  25. public function start();
  26. /**
  27. * Stop this Transport mechanism.
  28. */
  29. public function stop();
  30. /**
  31. * Check if this Transport mechanism is alive.
  32. *
  33. * If a Transport mechanism session is no longer functional, the method
  34. * returns FALSE. It is the responsibility of the developer to handle this
  35. * case and restart the Transport mechanism manually.
  36. *
  37. * @example
  38. *
  39. * if (!$transport->ping()) {
  40. * $transport->stop();
  41. * $transport->start();
  42. * }
  43. *
  44. * The Transport mechanism will be started, if it is not already.
  45. *
  46. * It is undefined if the Transport mechanism attempts to restart as long as
  47. * the return value reflects whether the mechanism is now functional.
  48. *
  49. * @return bool TRUE if the transport is alive
  50. */
  51. public function ping();
  52. /**
  53. * Send the given Message.
  54. *
  55. * Recipient/sender data will be retrieved from the Message API.
  56. * The return value is the number of recipients who were accepted for delivery.
  57. *
  58. * This is the responsibility of the send method to start the transport if needed.
  59. *
  60. * @param string[] $failedRecipients An array of failures by-reference
  61. *
  62. * @return int
  63. */
  64. public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null);
  65. /**
  66. * Register a plugin in the Transport.
  67. */
  68. public function registerPlugin(Swift_Events_EventListener $plugin);
  69. }