setUsername($config['username']); } if (isset($config['password'])) { $this->setPassword($config['password']); } } // Call parent with original arguments parent::__construct($host, $port, $origConfig); } /** * Perform PLAIN authentication with supplied credentials * */ public function auth() { // Ensure AUTH has not already been initiated. parent::auth(); $this->_send('AUTH PLAIN'); $this->_expect(334); $this->_send(base64_encode("\0" . $this->getUsername() . "\0" . $this->getPassword())); $this->_expect(235); $this->auth = true; } /** * Set value for username * * @param string $username * @return Plain */ public function setUsername($username) { $this->username = $username; return $this; } /** * Get username * * @return string */ public function getUsername() { return $this->username; } /** * Set value for password * * @param string $password * @return Plain */ public function setPassword($password) { $this->password = $password; return $this; } /** * Get password * * @return string */ public function getPassword() { return $this->password; } }