SmtpTransport.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. * @author Chris Corbyn
  13. * @method Swift_SmtpTransport setUsername(string $username) Set the username to authenticate with.
  14. * @method string getUsername() Get the username to authenticate with.
  15. * @method Swift_SmtpTransport setPassword(string $password) Set the password to authenticate with.
  16. * @method string getPassword() Get the password to authenticate with.
  17. * @method Swift_SmtpTransport setAuthMode(string $mode) Set the auth mode to use to authenticate.
  18. * @method string getAuthMode() Get the auth mode to use to authenticate.
  19. */
  20. class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
  21. {
  22. /**
  23. * Create a new SmtpTransport, optionally with $host, $port and $security.
  24. *
  25. * @param string $host
  26. * @param int $port
  27. * @param string $security
  28. */
  29. public function __construct($host = 'localhost', $port = 25, $security = null)
  30. {
  31. call_user_func_array(
  32. array($this, 'Swift_Transport_EsmtpTransport::__construct'),
  33. Swift_DependencyContainer::getInstance()
  34. ->createDependenciesFor('transport.smtp')
  35. );
  36. $this->setHost($host);
  37. $this->setPort($port);
  38. $this->setEncryption($security);
  39. }
  40. /**
  41. * Create a new SmtpTransport instance.
  42. *
  43. * @param string $host
  44. * @param int $port
  45. * @param string $security
  46. *
  47. * @return Swift_SmtpTransport
  48. */
  49. public static function newInstance($host = 'localhost', $port = 25, $security = null)
  50. {
  51. return new self($host, $port, $security);
  52. }
  53. }