SmtpTransport.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. *
  14. * @method Swift_SmtpTransport setUsername(string $username) Set the username to authenticate with.
  15. * @method string getUsername() Get the username to authenticate with.
  16. * @method Swift_SmtpTransport setPassword(string $password) Set the password to authenticate with.
  17. * @method string getPassword() Get the password to authenticate with.
  18. * @method Swift_SmtpTransport setAuthMode(string $mode) Set the auth mode to use to authenticate.
  19. * @method string getAuthMode() Get the auth mode to use to authenticate.
  20. */
  21. class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
  22. {
  23. /**
  24. * @param string $host
  25. * @param int $port
  26. * @param string|null $encryption SMTP encryption mode:
  27. * - null for plain SMTP (no encryption),
  28. * - 'tls' for SMTP with STARTTLS (best effort encryption),
  29. * - 'ssl' for SMTPS = SMTP over TLS (always encrypted).
  30. */
  31. public function __construct($host = 'localhost', $port = 25, $encryption = null)
  32. {
  33. \call_user_func_array(
  34. [$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($encryption);
  41. }
  42. }