Adding Mailing List
Use the add-list operation to add a new mailing list.
Request Packet Structure
A request XML packet adding a mailing list to Plesk database includes the add-list operation node:
<packet>
<maillist>
<add-list>
...
</add-list>
</maillist>
</packet>
The add-list node is presented by the MaillistAddListInputType
type (maillist.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 site-id node is required. It specifies the site ID in Plesk database. Data type: integer.
- The name node is required. It specifies the name of the mailing list. Data type: string.
- The password node is required. It specifies the mailing list administrator’s password. Data type: string.
- The admin-email node is required. It specifies the mailing list administrator’s e-mail address. All information on the mailing list management is sent to this e-mail address. Data type: string.
- The notify node is optional. Specifies if a notification of the mailing list creation will be sent to the administrator. Data type: boolean.
Remarks
You can add multiple mailing lists in a single packet. Add as many add-list operations as the number of mailing lists to be added.
<add-list>
...
</add-list>
...
<add-list>
...
</add-list>
Note: When creating request packets, put nodes and elements in the order they follow in the packet structure.
Response Packet Structure
The add-list node of the output XML packet is presented by type
MaillistAddOutputType (maillist.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: ResultType (
common.xsd
). - The status node is required. It specifies the execution status of the add-list operation. Data type: string. Allowed values: ok | error.
- The errcode node is optional. Is returns the error code if the add-list operation fails. Data type: integer.
- The errtext node is optional. It returns the error message if the add-list operation fails. Data type: string.
- The id node is optional. It returns the mailing list ID in Plesk database if the operation succeeds. Data type: integer.
Samples
Adding a single mailing list
This request packet adds mailing list MyMailer to the site specified by ID 45.
<packet>
<maillist>
<add-list>
<site-id>45</site-id>
<name>MyMailer</name>
<password>hello</password>
<admin-email>admin@mysite.com</admin-email>
</add-list>
</maillist>
</packet>
Response:
<packet>
<maillist>
<add-list>
<result>
<status>ok</status>
<id>133</id>
</result>
</add-list>
</maillist>
</packet>
If the Mailman software is not installed on the server, the response looks as follows:
<packet>
<maillist>
<add-list>
<result>
<status>error</status>
<errcode>1031</errcode>
<errtext>Component is not configured on server</errtext>
</result>
</add-list>
</maillist>
</packet>
Adding multiple mailing lists
This request packet adds mailing lists MyMailer and SubscribeMe to the site specified by ID 45.
<packet>
<maillist>
<add-list>
<site-id>45</site-id>
<name>MyMailer</name>
<password>hello</password>
<admin-email>admin@mysite.com</admin-email>
</add-list>
<add-list>
<site-id>45</site-id>
<name>SubscribeMe</name>
<password>123456</password>
<admin-email>admin@mysite.com</admin-email>
</add-list>
</maillist>
</packet>
Response:
<packet>
<maillist>
<add-list>
<result>
<status>ok</status>
<id>133</id>
</result>
</add-list>
<add-list>
<result>
<status>ok</status>
<id>134</id>
</result>
</add-list>
</maillist>
</packet>