Deleting Mail Accounts

The remove operation is used to remove one to many mail accounts at one stroke, provided all these accounts refer to the same site. Plesk Administrator can remove any mail account registered in Plesk, while a Plesk customer can delete mail accounts referring to sites that belong to this Plesk customer only.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet that deletes mail accounts should include the remove operation node:

<packet>
 <mail>
  <remove>
   ...
  </remove>
 </mail>
</packet>

 

The remove node does not have a separate type, it is nested within the MailTypeRequest type (mail_input.xsd). The remove node has the following graphics representation:

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 what mail accounts should be removed. Data type: mailFilterType (mail_input.xsd).
  • The site-id node is required. It specifies the identifier of the site which mail account (or several) will be deleted. Data type: integer.
  • The name node is optional. It specifies the name of the mail account to be deleted. Data type: string.

 

Remarks

To remove all mail accounts existing on a site, include to your request packet filter rule containing only site-id node.

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

 

Response Packet Structure

The remove node of the response packet is structured as follows:

mail-remove-reps.gif

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 optional. It wraps the result of the requested remove operation. Data type: resultType (common.xsd).
  • The status node is required. It returns the execution status of the del operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Returns an error code when the remove operation fails. Data type: unsignedInt.
  • The errtext node is optional. Returns an error message if the remove operation fails. Data type: string.
  • The mailname node is optional. It is required if the operation succeeds. Returns a list of updated mail accounts. Data type: complex (mail_output.xsd).
  • The name node is optional. It contains a mail account name. Data type: string.
 

Samples

The following packet deletes a mail account:

<packet version="1.6.3.0">
<mail>
<remove>
   <filter>
      <site-id>1</site-id>
      <name>techdept</name>
    </filter>
</remove>
</mail>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.3.0">
  <mail>
    <remove>
      <result>
        <status>ok</status>
        <mailname>
          <name>techdept</name>
        </mailname>
      </result>
    </remove>
  </mail>
</packet>

To delete several mail accounts belonging to different sites, use multiple remove sections:

<packet version="1.6.3.0">
<mail>
<remove>
   <filter>
      <site-id>12</site-id>
      <name>techdept</name>
      <name>techknowledge</name>
   </filter>
</remove>
<remove>
   <filter>
      <site-id>13</site-id>
      <name>findept</name>
      <name>proddept</name>
   </filter>
</remove>
</mail>
</packet>

 

To delete all mail accounts from the specified site, the following packet can be used:

<packet version="1.6.3.0">
<mail>
<remove>
   <filter>
      <site-id>12</site-id>
   </filter>
</remove>
</mail>
</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.