Exemplo n.º 1
0
 static function instance($params = array())
 {
     if (!is_object(self::$instance)) {
         $obj = new eZClusterSMTP($params);
         self::$instance = $obj;
         if ($obj->connect()) {
             $obj->status = smtp::STATUS_CONNECTED;
         }
         return $obj;
     } else {
         return self::$instance;
     }
 }
Exemplo n.º 2
0
function testConnection($parameters)
{
    $cli = eZCLI::instance();
    #$connection = eZClusterSMTP::connect( $parameters );
    $connection = eZClusterSMTP::instance($parameters);
    if (count($connection->errors) == 0) {
        $cli->output("Connected to " . $parameters['host']);
        return true;
    } else {
        $cli->output("ERROR while connecting to " . $parameters['host']);
        foreach ($connection->errors as $error) {
            $cli->output("Server Respond: " . $error);
        }
        return false;
    }
    $connection->quit();
}