Plesk

How to create several mailboxes on a Plesk server at once using a single command or a script?

Question

How to create several mailboxes in Plesk at once using a single command or a script in the command line?

Answer

  1. Connect to the server via SSH/RDP.

  2. Create a file mail.txt using any text editor with a list of mail addresses and passwords for it:

    example1@example.com password
    example2@example.com password
    ...
    exampleN@example.com password

    Note: Make sure that passwords comply with the current Password Strength Policy

  3. Follow the instructions below for creating mailboxes from the mail.txt file:

    For Linux

    1. Download the attached script:

      # wget https://support.plesk.com/hc/en-us/article_attachments/12377375244567/createmail_.tar.gz

    2. Unpack the downloaded archive:

      # tar -zxvf createmail_.tar.gz

    3. Execute the script:

      # ./createmail.sh mail.txt

    For Windows

    1. Start the Command prompt as Administrator.

    2. Execute the command below to create mailboxes from the list created on step 2:

      Note: In the example below, mail.txt file exists in C:mail.txt. Adjust the path to the mail.txt file if required

      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 command plesk bin mail in the script. For details on using these options, check the documentation articles: for Linux and for Windows.