Zend Certified Engineer

phpguru.org

Free PHP, Javascript and C# code

Net_Sieve

This class enables you to talk to the timsieved server that comes with Cyrus IMAP. This means you can install, list, update and set active Sieve scripts. You can download it via the PEAR web site. The PEAR info page is here. It requires the Net_Socket class which you can get here, which in turn relies on the PEAR library. If you do not have the PEAR library (try doing a require('PEAR.php');) you can get it here. Some basic documentation of the API is below. It has only been tested with Cyrus 2.0.16.

Class API

Constructor

Arguments:

  • string Username
  • string Password
  • string Hostname (Optional, defaults to localhost)
  • integer Port (Optional, defaults to 2000)
  • string Login type (Optional, defaults to PLAIN)

Simply sets up the object and connects to the server. If there is an error it will be set in the _error property.

listScripts()

No arguments. Returns a numerically indexed array of scriptnames that are currently installed on the server.

getActive()

No arguments. Returns the name of the currently active script.

setActive()

Arguments:

  • string Script name

Sets the active script to the given script name.

getScript()

Arguments:

  • string Script name

Returns the script with the given name.

installScript()

Arguments:

  • string Script name
  • string Script
  • boolean Whether to make the active script (Optional, defaults to false)

This function adds a script (second argument) to the server with the given name (first argument). It will optionally make it active (third argument).

removeScript()

Arguments:

  • string Script name

Deletes the given script from the server

getError()

If the _error property is an error (an object of class PEAR_Error), this function will return it. It will return false otherwise. Use to determine if there was an error during the call to the constructor.

Link to me

If you use any of the code on this site (and if you don't I guess) or it makes your life easier, I'd appreciate a link - http://www.phpguru.org. Thanks.

Last modified: 16:55 29th December 2006