SmtpTransport.php 1.9 KB

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