Mail user account can be created on the specified site. To register new mail account in Plesk database, it is enough to specify some general setup information, namely: the site ID where the mail account will be registered, and the mail account name.
In addition, you can specify various mail account settings (all of them are optional):
A mail account can have all these settings specified, or it can hold just some of them. You can specify these settings when creating a mail account or later (they can be set using the set_prefs operation).
A request XML packet creating a mail account in Plesk database includes the create operation node:
<packet>
<mail>
<create>
...
</create>
</mail>
</packet>
The create node does not have a separate type, it is nested within the MailTypeRequest type (mail_input.xsd
). The create node has the following graphics representation:
plesk_mailname.xsd
)plesk_mailname.xsd
). See the structure of this node in the Mail Account Settings section.
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
The create node of the response packet is structured as follows:
common.xsd
).plesk_mailname.xsd
). To see the structure of this node, refer to the Mail User Account Settings section.
The following packet creates two mail accounts on a single site:
<?xml version="1.0" encoding="UTF-8"?>
<packet>
<mail>
<create>
<filter>
<site-id>1</site-id>
<mailname>
<name>techdept11</name>
<mailbox>
<enabled>true</enabled>
<quota>1024000</quota>
</mailbox>
<forwarding>
<enabled>true</enabled>
<address>paul555@testdomain.tst</address>
</forwarding>
<alias>michael555</alias>
<autoresponder>
<enabled>true</enabled>
<subject>Your request is accepted</subject>
<content_type>text/html</content_type>
<charset>UTF-8</charset>
<text>Your request will be processed in the nearest 10 days. Thank you.</text>
<attachment>
<tmp-name>/tmp/attachment-file.txt</tmp-name>
<file-name>rules.txt</file-name>
</attachment>
<forward>techdept@technolux.co.uk</forward>
</autoresponder>
<password>
<value>test123</value>
<type>plain</type>
</password>
<antivir>inout</antivir>
</mailname>
<mailname>
<name>admin11</name>
<password>
<value>test</value>
<type>plain</type>
</password>
<antivir>inout</antivir>
</mailname>
</filter>
</create>
</mail>
</packet>
To create multiple mail accounts on different sites within one packet, use multiple create nodes:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
<mail>
<create>
<result>
<status>ok</status>
<mailname>
<id>5</id>
<name>techdept11</name>
</mailname>
</result>
</create>
</mail>
<result>
<status>ok</status>
<mailname>
<id>6</id>
<name>admin11</name>
</mailname>
</result>
</create>
</mail>
</packet>