THIS SCRIPT IS DISABLED FOR SECURITY REASONS.
PLEASE COMMENT OUT LINE ". __LINE__ ." TO ENABLE THIS SCRIPT.");
########################################
# SSL example
########################################
#$host = 'ssl://127.0.0.1';
#$port = 993;
#$username1 = 'username';
#$password1 = 'password';
#$username2 = 'username';
#$password2 = 'password';
########################################
# TLS example
########################################
#$host = 'tls://127.0.0.1';
#$port = 993;
#$username1 = 'username';
#$password1 = 'password';
#$username2 = 'username';
#$password2 = 'password';
########################################
# no encryption or STARTTLS
########################################
$host = '127.0.0.1';
$port = 143;
$username1 = 'username';
$password1 = 'password';
$username2 = '';
$password2 = '';
# folder to use for testing the SORT feature
$testFolder = 'INBOX';
$enableSTARTTLS = true;
$startTime = microtime(true);
print "
"; set_include_path('../egw-pear'. PATH_SEPARATOR .'/usr/share/php'. PATH_SEPARATOR . get_include_path()); require_once 'Net/IMAP.php'; print ""; ?>ATTENTION: THIS OUTPUT CONTAINS YOUR USERNAME AND PASSWORD!!!
"; $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Login as user $username1
"; $imapClient = new Net_IMAP($host, $port, $enableSTARTTLS); $imapClient->setDebug(true); $imapClient->login($username1, $password1, true, false); $imapClient->selectMailbox($testFolder); if(!empty($username2) && !empty($password2)) { $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Login as user $username2
"; $imapClient2 = new Net_IMAP($host); $imapClient2->setDebug(true); $imapClient2->login($username2, $password2, true, false); } $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Getting hierarchy delimiter
"; $delimiter = $imapClient->getHierarchyDelimiter(); print "delimiter is: $delimiter
"; $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: List all folders
"; $imapClient->getMailboxes(); $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: List all subscribed folders
"; $imapClient->listsubscribedMailboxes(); $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Checking for ACL support: "; if($imapClient->hasCapability('ACL')) { print "supported
"; $imapClient->getMyRights($testFolder); $imapClient->getACLRights($username1, $testFolder); if(!empty($username2)) { $imapClient->setACL($testFolder, $username2, 'lrswipcda'); $imapClient->getACLRights($username2, $testFolder); $imapClient->deleteACL($testFolder, $username2); $imapClient->getACLRights($username2, $testFolder); } $imapClient->getACL($testFolder); } else { print "not supported"; } $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Checking for NAMESPACE support: "; if($imapClient->hasCapability('NAMESPACE')) { print "supported
"; $nameSpace = $imapClient->getNameSpace(); #print "parsed NAMESPACE info:
"; #var_dump($nameSpace); } else { print "not supported"; } $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Checking for QUOTA support: "; if($imapClient->hasCapability('QUOTA')) { print "supported
"; $quota = $imapClient->getStorageQuotaRoot(); print "parsed QUOTA info:
"; var_dump($quota); } else { print "not supported"; } $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Checking for SORT support: "; if($imapClient->hasCapability('SORT')) { print "supported
"; $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Sorting $testFolder by DATE:
"; $sortResult = $imapClient->sort('DATE'); $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Sorting $testFolder by SUBJECT:
"; $sortResult = $imapClient->sort('SUBJECT'); } else { print "not supported"; } $elapsedTime = microtime(true) - $startTime; print "$elapsedTime :: Logout
"; $imapClient->disconnect(); print "