[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/composer/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/ -> LoginAuthenticator.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of SwiftMailer.
   5   * (c) 2004-2009 Chris Corbyn
   6   *
   7   * For the full copyright and license information, please view the LICENSE
   8   * file that was distributed with this source code.
   9   */
  10  
  11  /**
  12   * Handles LOGIN authentication.
  13   *
  14   * @author Chris Corbyn
  15   */
  16  class Swift_Transport_Esmtp_Auth_LoginAuthenticator implements Swift_Transport_Esmtp_Authenticator
  17  {
  18      /**
  19       * Get the name of the AUTH mechanism this Authenticator handles.
  20       *
  21       * @return string
  22       */
  23      public function getAuthKeyword()
  24      {
  25          return 'LOGIN';
  26      }
  27  
  28      /**
  29       * {@inheritdoc}
  30       */
  31      public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
  32      {
  33          try {
  34              $agent->executeCommand("AUTH LOGIN\r\n", [334]);
  35              $agent->executeCommand(sprintf("%s\r\n", base64_encode($username)), [334]);
  36              $agent->executeCommand(sprintf("%s\r\n", base64_encode($password)), [235]);
  37  
  38              return true;
  39          } catch (Swift_TransportException $e) {
  40              $agent->executeCommand("RSET\r\n", [250]);
  41  
  42              throw $e;
  43          }
  44      }
  45  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1