Question
How to create several mailboxes at once using a single command or a script in command line?
Answer
Note: This article is intended for use by server administrators. In case there is no administrative SSH or RDP access to the server, contact the server administrator or server provider.
-
Create a file
mail.txt
with a list of mail addresses and a password for it:[email protected] password
[email protected] password
...
[email protected] password -
Execute the following script to create mailboxes from the list in command line:
-
for Linux – download, unpack and execute the script
createmail.sh
:# wget https://support.plesk.com/hc/en-us/article_attachments/360014711094/createmail_.tar.gz
# tar -zxvf createmail_.tar.gz
# ./createmail.sh mail.txt -
for Windows:
C:> for /F “tokens=1,2 delims= ” %i in (c:mail.txt) do plesk bin mail.exe -c %i -passwd %j -mailbox true
Note: other options, like
-mbox_quota
,-aliases
,-forwarding
etc., can be added to the commandplesk bin mail
in the script. For details on using these options, check the documentation articles: for Linux and for Windows. -