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:

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.

  • The filter node is required. It specifies the filtering rule. Data type: SpamassassinFilterType (spamfilter.xsd).
  • The preferences node is required. It specifies preferences of Spam Filtering service for a specified user. For information on preferences, refer to the Spam Filtering Preferences section. Data type:SpamassassinPreferencesType (spamfilter.xsd).

    Note: If you want to enable or disable Spam Filtering service without changing preferences, leave the preferences node blank (<preferences/>).

  • The enabled node is optional. Specify this node to enable Spam Filtering service for a specified SpamAssassin user. For more information, refer to the Managing Spam Filtering section. Data type: none.
  • The disabled node is optional. Specify this node to disable Spam Filtering service for a specified SpamAssassin user. For more information, refer to the Managing Spam Filtering section. Data type: none.

 

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:

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.

  • The result node is required. It wraps the response retrieved from the server. Data type: resultFilterType (common.xsd).
  • The status node is required. It specifies the execution status of the set operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the set operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the set operation fails. Data type: string.
  • The filter-id node is optional. It holds the filtering rule parameter. For information, refer to the Available Filters section. Data type: anySimpleType.
  • The id node is optional. It does not return any data for this operation. Data type: integer.

 

 

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>
 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.