[ 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/ -> PlainAuthenticator.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 PLAIN authentication.
  13   *
  14   * @author Chris Corbyn
  15   */
  16  class Swift_Transport_Esmtp_Auth_PlainAuthenticator 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 'PLAIN';
  26      }
  27  
  28      /**
  29       * {@inheritdoc}
  30       */
  31      public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
  32      {
  33          try {
  34              $message = base64_encode($username.chr(0).$username.chr(0).$password);
  35              $agent->executeCommand(sprintf("AUTH PLAIN %s\r\n", $message), [235]);
  36  
  37              return true;
  38          } catch (Swift_TransportException $e) {
  39              $agent->executeCommand("RSET\r\n", [250]);
  40  
  41              throw $e;
  42          }
  43      }
  44  }


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