# Protocol for Sieve script exchange

Note: This is not a standards track protocol. If you decide to base a program upon it you have been warned. This is a simple text-based protocol for getting user sieve scripts onto the (presumably sealed) IMAP server. The requirements for this process are:

- the user must authenticate to gain access, preferably via a secure SASL mechanism.
- only valid sieve scripts may be accepted

Additional features provided:

- the ability to manage multiple scripts on the server with zero or one of them being the "active" sieve script

### Types

This a line oriented protocol much like [IMAP] or [ACAP]. There are two types: ATOMS and strings. Strings may be quoted or literal. See [ACAP] for detailed descriptions.
sievename is a string where only certain characters are allowed and it must be at least 1 character long.

### Commands

`AUTHENTICATE SP string [SP string] EOL`
  SASL authentication; the parameters are the mechanism and optionally the initial data. Initial data is base64 encoded. The server replies with a OK or NO response, or a string base64 encoded followed by an EOL. Client then replies with a string base64 encoded followed by an EOL and the procedure is repeated.
`NOOP EOL`
  No side affects. OK, NO replies
`LOGOUT EOL`
  Logout, terminates connection. OK, NO replies.
`GETSCRIPT SP sievename EOL`
  The parameter is the name of the requested script. Returns: `string EOL` containing the script data. Get the script with name sievename from the server. OK, NO replies
`PUTSCRIPT SP sievename SP string EOL`
  Puts sievename with data data onto the server if possible. OK, NO replies.
`SETACTIVE SP sievename EOL`
  Set the script with the name sievename as the active script. Any other script that was active is no longer. OK, NO replies
`DELETESCRIPT SP sievename EOL`
  Delete the script with sievename. OK or NO replies.
`LISTSCRIPTS EOL`
  returns zero or more: sievename EOL. where the active script has a '*' at the end of it's name OK or NO replies