SmtpTransport.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 over SMTP with ESMTP support.
  11. * @package Swift
  12. * @subpackage Transport
  13. * @author Chris Corbyn
  14. */
  15. class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
  16. {
  17. /**
  18. * Create a new SmtpTransport, optionally with $host, $port and $security.
  19. * @param string $host
  20. * @param int $port
  21. * @param int $security
  22. */
  23. public function __construct($host = 'localhost', $port = 25,
  24. $security = null)
  25. {
  26. call_user_func_array(
  27. array($this, 'Swift_Transport_EsmtpTransport::__construct'),
  28. Swift_DependencyContainer::getInstance()
  29. ->createDependenciesFor('transport.smtp')
  30. );
  31. $this->setHost($host);
  32. $this->setPort($port);
  33. $this->setEncryption($security);
  34. }
  35. /**
  36. * Create a new SmtpTransport instance.
  37. * @param string $host
  38. * @param int $port
  39. * @param int $security
  40. * @return Swift_SmtpTransport
  41. */
  42. public static function newInstance($host = 'localhost', $port = 25,
  43. $security = null)
  44. {
  45. return new self($host, $port, $security);
  46. }
  47. }