Enabling/Disabling Mail Service on Domain

Use the enable (disable) operation to enable (disable) mail service on a particular site.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet that enables mail service on the specified site contains the enable operation node:

<packet>
  <mail>
    <enable>
     ...
    </enable>
  </mail>
</packet>

 

The enable node does not have a separate data type, it is nested within the MailTypeRequest type (mail_input.xsd). The enable 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 site-id node is required. It indicates the site on which mail service should be turned on. Data type: integer.

 

A request XML packet that disables mail service on the specified site contains the disable operation node:

<packet>
  <mail>
    <disable>
     ...
    </disable>
  </mail>
</packet>

 

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

  • The site-id node is required. It indicates the site on which mail service should be turned off. Data type: it_type (integer).
 

Response Packet Structure

The enable node of the response packet is 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 optional. It wraps the result of the requested enable operation. Data type: resultType (common.xsd).

  • The status node is required. It returns the execution status of the enable operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It is used to return an error code if the enable operation fails. Data type: unsignedInt.
  • The errtext node is optional. Can be used to return an error message if the enable operation fails. Data type: string.

 

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

  • The result node is optional. It wraps the result of the requested disable operation. Data type: resultType (common.xsd).
  • The status node is required. It returns the execution status of the disable operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It is used to return an error code if the disable operation fails. Data type: unsignedInt.
  • The errtext node is optional. Can be used to return an error message if the disable operation fails. Data type: string.
 

Samples

Enabling mail service on multiple sites

The following request packet demonstrates how mail service can be enabled on multiple sites:

<packet>
<mail>
 <enable>
   <site-id>1</site-id>
 </enable>
 <enable>
   <site-id>2</site-id>
 </enable>
 </mail>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
  <mail>
    <enable>
      <result>
        <status>ok</status>
      </result>
    </enable>
    <enable>
      <result>
        <status>ok</status>
      </result>
    </enable>
  </mail>
</packet>
Disabling mail service on multiple sites

To disable mail service on multiple sites, send the following request:

<packet>
<mail>
 <disable>
   <site-id>1</site-id>
 </disable>
 <disable>
   <site-id>2</site-id>
 </disable>
 </mail>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
  <mail>
    <disable>
      <result>
        <status>ok</status>
      </result>
    </disable>
    <disable>
      <result>
        <status>ok</status>
      </result>
    </disable>
  </mail>
</packet>
Enabling mail service on one site and disabling on another site

XML API allows the use of both these operations within a single packet and within the same mail operator:

<packet>
<mail>
 <enable>
   <site-id>1</site-id>
 </enable>
 <disable>
   <site-id>2</site-id>
 </disable>
</mail>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
  <mail>
    <enable>
      <result>
        <status>ok</status>
      </result>
    </enable>
    <disable>
      <result>
        <status>ok</status>
      </result>
    </disable>
  </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.