00001 <?php
00027 require_once 'Zend/Mail/Protocol/Smtp.php';
00028
00029
00039 class Zend_Mail_Protocol_Smtp_Auth_Plain extends Zend_Mail_Protocol_Smtp
00040 {
00046 protected $_username;
00047
00048
00054 protected $_password;
00055
00056
00065 public function __construct($host = '127.0.0.1', $port = null, $config = null)
00066 {
00067 if (is_array($config)) {
00068 if (isset($config['username'])) {
00069 $this->_username = $config['username'];
00070 }
00071 if (isset($config['password'])) {
00072 $this->_password = $config['password'];
00073 }
00074 }
00075
00076 parent::__construct($host, $port, $config);
00077 }
00078
00079
00085 public function auth()
00086 {
00087
00088 parent::auth();
00089
00090 $this->_send('AUTH PLAIN');
00091 $this->_expect(334);
00092 $this->_send(base64_encode(chr(0) . $this->_username . chr(0) . $this->_password));
00093 $this->_expect(235);
00094 $this->_auth = true;
00095 }
00096 }