/** * Check login data and return true on success * or string with error message * * @param string $username * @param string $password * @return string|true */ public function testAuth($username, $password) { $connection = new Zend_Mail_Protocol_Smtp_Auth_Login(self::HOST, self::PORT, array('username' => $username, 'password' => $password, 'port' => self::PORT, 'ssl' => self::SSL)); try { $connection->connect(); $connection->helo(Mage::app()->getRequest()->getServer('SERVER_ADDR')); $connection->disconnect(); return true; } catch (Exception $e) { return $e->getMessage(); } }