Use the rename operation to rename a mail account.

Request Packet Structure

A request XML packet setting a new name for an existing mail account should include the rename operation node:

<packet>
 <mail>
  <rename>
   ...
  </rename>
 </mail>
</packet>

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

image 34552

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 site-id node is required. It identifies the site that owns the mail account. Data type: integer.
  • The name node is required. It specifies the current name of the mail account. Data type: string.
  • The new-name node is required. It specifies the new name for the mail account. Data type: string.

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

Response Packet Structure

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

image 34555

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 rename operation. Data type: resultType (common.xsd).
  • The status node is required. It returns the execution status of the rename operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Returns an error code when the rename operation fails. Data type: unsignedInt.
  • The errtext node is optional. Returns an error message if the rename operation fails. Data type: string.

Samples

Renaming a single mail account

The following request packet renames mail account existing on the site with ID 11:

<packet version="1.6.3.0">
<mail>
<rename>
   <site-id>11</site-id>
   <name>admin</name>
   <new-name>administrator</new-name>
</rename>
</mail>
</packet>

Response:

<packet version="1.6.7.0">
<mail>
<rename>
   <result>
      <status>ok</status>
   </result>
</rename>
</mail>
</packet>

Renaming multiple mail acounts

To rename multiple mail accounts with a single packet, use a separate rename section for each:

<packet version="1.6.3.0">
<mail>
<rename>
   <site-id>11</site-id>
   <name>admin</name>
   <new-name>administrator</new-name>
</rename>
<rename>
   <site-id>11</site-id>
   <name>common</name>
   <new-name>main</new-name>
</rename>
</mail>
</packet>

Response:

<packet version="1.6.7.0">
<mail>
<rename>
   <result>
      <status>ok</status>
   </result>
</rename>
<rename>
   <result>
      <status>ok</status>
   </result>
</rename>
</mail>
</packet>