Setting Spam Filtering Preferences

Use the set operation to change status of Spam Filtering service, and Spam Filtering preferences for a specified user (Administrator or mailbox owner).

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet changing Spam Filtering service status and preferences includes the set operation node:

<packet>
<spamfilter>
<set>
...  
</set>
</spamfilter>
</packet>

 

The set node is presented by the SpamFilterGetInputType type (spamfilter.xsd), and its graphical representation is as follows:

 

Remarks

You can retrieve info on users specified by SpamAssassin ID, and users specified by e-mail address in a single packet. Add ID's of users specified by SpamAssassin ID to the filter node of the first set operation, and e-mail addresses of users specified by e-mail address (or 'admin' string) to the filter node of the second set operation.

<set>
<filter>...</filter>
   ...
</set>
 
<set>
<filter>...</filter>
   ...
</set>

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 

Response Packet Structure

The set node of the output XML packet is presented by type SpamFilterSetOutputType (spamfilter.xsd) and structured as follows:

 

 

Samples

Changing info of a single user

This request packet enables Spam Filtering service on the server.

<packet>
<spamfilter>
   <set>
      <filter>
         <username>admin</username>
      </filter>
      <preferences/>
      <enabled/>
   </set>
</spamfilter>
</packet>

Response:

<packet>
<spamfilter>
   <set>
   <result>
      <status>ok</status>
      <filter-id>admin</filter-id>
   </result>
   </set>
</spamfilter>
</packet>

 

If inappropriate options for Administrator were nested in the parameters node of the request packet, the response from the server is as follows:

<packet>
<spamfilter>
   <set>
   <result>
      <status>error</status>
      <errcode>12009</errcode>
      <errtext>Option is not supported</errtext>
      <filter-id>admin</filter-id>
   </result>
   </set>
</spamfilter>
</packet> 
Changing info for multiple users

This packet requests for deleting incoming spam coming to mailboxes my@account.com and mail@account.com. It also enables Spam Filtering service on the mailbox specified by SpamAssassin ID 12.

<packet>
<spamfilter>
<set>

   <filter>
      <username>my@account.com</username>
      <username>mail@account.com</username>
   </filter>
 
   <preferences>
      <action>delete</action>
   </preferences>
<enabled/>
</set>
<set>
   <filter>
      <spamfilter-id>my@account.com</spamfilter-id>
   </filter>
   <preferences/>
   <enabled/>
</set>
</spamfilter>
</packet>

 

If mailbox mail@account.com was not found on the server, a response from the server can look as follows:

<packet>
<spamfilter>
 
   <set>
   <result>
      <status>ok</status>
      <filter-id>my@account.com</filter-id>
   </result>
   <result>
      <status>error</status>
      <errcode>1013</errcode>
      <errtext>Mailbox does not exist</errtext>
      <filter-id>mail@account.com</filter-id>
   </result>
</set>
<set>
   <result>
      <status>ok</status>
      <filter-id>12</filter-id>
   </result>
</set>
</spamfilter>
</packet>