Plesk

How to create mail accounts in bulk using CLI in Plesk for Linux?

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:

  1. Connect to the server via SSH

  2. Create a list of mail addresses to be created with one mail address per line as in the following example:

    # cat maillist.txt
    jane_doe@example.com
    john_doe@example.com
    mike_doe@example.com

    Note: In this example, maillist.txt is the name of the file containing the mail address list.

  3. 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 'jane_doe@example.com' complete
    SUCCESS: Creation of mailname 'john_doe@example.com' complete
    SUCCESS: Creation of mailname 'mike_doe@example.com' complete

  4. Once accounts are created, each email owner will have to set a password at Domains > example.com > Mail > Email Addresses > john_doe@example.com > Password.

Additional Information

Exit mobile version