TYPO3  7.6
PlainAuthenticator.php
Go to the documentation of this file.
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 
17 {
23  public function getAuthKeyword()
24  {
25  return 'PLAIN';
26  }
27 
37  public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
38  {
39  try {
40  $message = base64_encode($username.chr(0).$username.chr(0).$password);
41  $agent->executeCommand(sprintf("AUTH PLAIN %s\r\n", $message), array(235));
42 
43  return true;
44  } catch (Swift_TransportException $e) {
45  $agent->executeCommand("RSET\r\n", array(250));
46 
47  return false;
48  }
49  }
50 }