- Plesk for Linux
How to create a lot of mail accounts at once instead of creating them individually?
Such an operation can be accomplished with the help of CLI (command line interface) utilities.
Command line utilities for Plesk for Linux/Unix are located in the /PRODUCT\_ROOT\_D/bin directory on the Plesk server.
There is a specific utility for managing Plesk mail accounts: /PRODUCT\_ROOT\_D/bin/mail
The mail utility is used to manage domain mail service and mail names (email accounts) through CLI. By using this utility, you can perform the following tasks:
Enabling or disabling mail service on a domain
Creating and deleting mail accounts
Editing mail account settings
Managing mail groups associated with mail accounts
Managing mail user control panel access
Managing mail user control panel interface parameters With help of this utility, it is possible to automate the process of managing mail accounts. For more information, please refer to the appropriate documentation version. For example:
For example, to create a bunch of mailboxes follow the below instruction:
Log in to Plesk server using SSH.
Create a text file
/root/mailboxes.txtwhich contains the names of mailboxes required to be created:
# cat /root/mailboxes.txt
Execute the command:
# for i in `cat /root/mailboxes.txt`; do /usr/local/psa/bin/mail -c $i; done