Question
How to create mail accounts in bulk using CLI in Plesk for Linux?
Answer
The following command can iterate through a list of email addresses and create them using the command-line Mail utility:
-
Connect to the server via SSH
-
Create a list of mail addresses to be created with one mail address per line as in the following example:
# cat maillist.txt
[email protected]
[email protected]
[email protected]Note: In this example,
maillist.txt
is the name of the file containing the mail address list. -
Run the following command on the same directory where the file is located. This will iterate the list and create the accounts included in the file:
# for i in `cat maillist.txt`; do plesk bin mail --create $i -mailbox true; done
The output should look like the following:
SUCCESS: Creation of mailname '[email protected]' complete
SUCCESS: Creation of mailname '[email protected]' complete
SUCCESS: Creation of mailname '[email protected]' complete -
Once accounts are created, each email owner will have to set a password at Domains > example.com > Mail > Email Addresses > [email protected] > Password.