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

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:

image 34529

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.9.1/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 (m``ail_input.xsd``). The disable node has the following graphics representation:

image 34530

  • 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:

image 34533

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.9.1/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:

image 34534

  • 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:

<packet>
    <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:

<packet>
    <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:

<packet>
    <mail>
        <enable>
            <result>
                <status>ok</status>
            </result>
        </enable>
        <disable>
            <result>
                <status>ok</status>
            </result>
        </disable>
    </mail>
</packet>