Use the add-member operation to add a new subscriber to a mailing list specified by name or ID.

Request Packet Structure

A request XML packet adding a subscriber includes the add-member operation node:

<packet>
<maillist>
<add-member>
...
</add-member>
</maillist>
</packet>

The add-member node is presented by the MaillistAddMemberInputType type (maillist.xsd), and its graphical representation is as follows:

image 36253

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 the filtering rule. You can subscribe a person specified by id to multiple mailing lists in a single packet. For information on this filter, refer to the Available Filters section. Data type: MaillistSimpleFilterType (maillist.xsd) .
  • The id node is required. It specifies the subscriber’s e-mail address. Data type: emailType (common.xsd).

Remarks

You can add multiple subscribers to a mailing list using different filtering rules in a single packet. Add as many add-member operations as the number of different filtering rules to be applied.

<add-member>
   ...
</add-member>
   ...
<add-member>
   ...
</add-member>

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

Response Packet Structure

The add-member node of the output XML packet is presented by type MaillistAddMemberOutputType (maillist.xsd) and structured as follows:

image 36263

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: MaillistMemberResultType (maillist.xsd).
  • The status node is required. It specifies the execution status of the add-member operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the add-member operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the add-member operation fails. Data type: string.
  • The filter-id node is optional. It holds the filtering rule parameter. For information, refer to the Available Filters section. Data type: anySimpleType.
  • The id node is optional. It returns the subscriber’s email address if the operation succeeds. Data type: emailType (common.xsd) .

Samples

Adding a subscriber

This request packet adds the subscriber with e-mail address mymail@mysite.com to mailing list MyMailer.

<packet>
<maillist>
<add-member>
   <filter>
      <list-name>MyMailer</list-name>
   </filter>
   <id>mymail@mysite.com</id>
</add-member>
</maillist>
</packet>

Response:

<packet>
<maillist>
<add-member>
   <result>
      <status>ok</status>
      <filter-id>MyMailer</filter-id>
      <id>mymail@mysite.com</id>
   </result>
</add-member>
</maillist>
</packet>

If the mailing list was not found on the server, the response looks as follows:

<packet>
<maillist>
<add-member>
   <result>
      <status>error</status>
      <errcode>1015</errcode>
      <errtext>Mailing list does not exist</errtext>
      <filter-id>MyMailer</filter-id>
   </result>
</add-member>
</maillist>
</packet>

Adding subscribers to multiple mailing lists

This request packet adds the subscriber with e-mail address mymail@mysite.com to mailing lists MyMailer and SubscribeMe.

<packet>
<maillist>
<add-member>
   <filter>
      <list-name>MyMailer</list-name>
      <list-name>SubscribeMe</list-name>
   </filter>
   <id>mymail@mysite.com</id>
</add-member>
</maillist>
</packet>

Response:

<packet>
<maillist>
<add-member>
   <result>
      <status>ok</status>
      <filter-id>MyMailer</filter-id>
      <id>mymail@mysite.com</id>
   </result>
   <result>
      <status>ok</status>
      <filter-id>SubscribeMe</filter-id>
      <id>mymail@mysite.com</id>
   </result>
</add-member>
</maillist>
</packet>