SmtpTransport.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 string $security
  22. */
  23. public function __construct($host = 'localhost', $port = 25, $security = null)
  24. {
  25. call_user_func_array(
  26. array($this, 'Swift_Transport_EsmtpTransport::__construct'),
  27. Swift_DependencyContainer::getInstance()
  28. ->createDependenciesFor('transport.smtp')
  29. );
  30. $this->setHost($host);
  31. $this->setPort($port);
  32. $this->setEncryption($security);
  33. }
  34. /**
  35. * Create a new SmtpTransport instance.
  36. * @param string $host
  37. * @param int $port
  38. * @param string $security
  39. * @return Swift_SmtpTransport
  40. */
  41. public static function newInstance($host = 'localhost', $port = 25, $security = null)
  42. {
  43. return new self($host, $port, $security);
  44. }
  45. }