SmtpTransport.php 1.3KB

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