Connection.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Swift Mailer Connection Interface
  4. * All connection handlers extend this abstract class
  5. * Please read the LICENSE file
  6. * @author Chris Corbyn <chris@w3style.co.uk>
  7. * @package Swift_Connection
  8. * @license GNU Lesser General Public License
  9. */
  10. /**
  11. * Swift Connection Interface
  12. * Lists methods which are required by any connections
  13. * @package Swift_Connection
  14. * @author Chris Corbyn <chris@w3style.co.uk>
  15. */
  16. interface Swift_Connection
  17. {
  18. /**
  19. * Try to start the connection
  20. * @throws Swift_ConnectionException If the connection cannot be started
  21. */
  22. public function start();
  23. /**
  24. * Return the contents of the buffer
  25. * @return string
  26. * @throws Swift_ConnectionException If the buffer cannot be read
  27. */
  28. public function read();
  29. /**
  30. * Write a command to the buffer
  31. * @param string The command to send
  32. * @throws Swift_ConnectionException If the write fails
  33. */
  34. public function write($command, $end="\r\n");
  35. /**
  36. * Try to stop the connection
  37. * @throws Swift_ConnectionException If the connection cannot be closed/stopped
  38. */
  39. public function stop();
  40. /**
  41. * Check if the connection is up or not
  42. * @return boolean
  43. */
  44. public function isAlive();
  45. /**
  46. * Add an extension which is available on this connection
  47. * @param string The name of the extension
  48. * @param array The list of attributes for the extension
  49. */
  50. public function setExtension($name, $list=array());
  51. /**
  52. * Check if an extension exists by the name $name
  53. * @param string The name of the extension
  54. * @return boolean
  55. */
  56. public function hasExtension($name);
  57. /**
  58. * Get the list of attributes for the extension $name
  59. * @param string The name of the extension
  60. * @return array
  61. * @throws Swift_ConnectionException If no such extension can be found
  62. */
  63. public function getAttributes($name);
  64. /**
  65. * Execute logic needed after SMTP greetings
  66. * @param Swift An instance of Swift
  67. */
  68. public function postConnect(Swift $instance);
  69. /**
  70. * Returns TRUE if the connection needs a EHLO greeting.
  71. * @return boolean
  72. */
  73. public function getRequiresEHLO();
  74. /**
  75. * Set if the connection needs a EHLO greeting.
  76. * @param boolean
  77. */
  78. public function setRequiresEHLO($set);
  79. }