示例#1
0
//$sieve=new Net_Sieve($user, $passwd, $host , $port, 'DIGEST-MD5' );
//$sieve=new Net_Sieve($user, $passwd, $host , $port);
$sieve = new Net_Sieve();
$sieve->setDebug(true);
if (PEAR::isError($error = $sieve->connect($host, $port))) {
    echo "  there was an error trying to connect to the server. The error is: " . $error->getMessage() . "\n";
    exit;
}
//if(PEAR::isError($error = $sieve->login($user, $passwd  , 'PLAIN' , '', false ) ) ){
if (PEAR::isError($error = $sieve->login($user, $passwd, null, '', false))) {
    echo "  there was an error trying to connect to the server. The error is: " . $error->getMessage() . "\n";
    exit;
}
// I list the scripts that I Have installed
echo "These are the scripts that I have in the server:\n";
print_r($sieve->listScripts());
echo "\n";
echo "I remove script 1 ({$sieve_script_name1})......\n";
if (!PEAR::isError($error = $sieve->removeScript($sieve_script_name1))) {
    echo "  script '{$sieve_script_name1}' removed ok!\n";
} else {
    echo "  there was an error trying to remove the script '{$sieve_script_name1}'. The error is: " . $error->getMessage() . "\n";
}
echo "\n";
// I try to delete again de same script, the method must fail
echo "I remove script 1 ({$sieve_script_name1})......\n";
if (!PEAR::isError($error = $sieve->removeScript($sieve_script_name1))) {
    echo "  script '{$sieve_script_name1}' removed ok!\n";
} else {
    echo "  there was an error trying to remove the script '{$sieve_script_name1}'. The error is: " . $error->getMessage() . "\n";
}