Articles in this section

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

Plesk for Windows kb: how-to Plesk for Linux ABT: Group B

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

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:

    CONFIG_TEXT: 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 by the using the mail.txt file you have generated:

    For Linux
    1. Download the attached script by executing the following command:

      # 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 towards the mail.txt file created on step 2:

      # ./createmail.sh mail.txt

    For Windows
    1. Run Command Prompt as the Administrator

    2. Execute the command below to create mailboxes from by using the mail.txt 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.

Was this article helpful?

Comments

2 comments
Date Votes
  • The file download ist not found (404).

    content:

    #!/bin/bash
    #
    file=$1
    while IFS= read -r line
    do
    email=`echo$line| awk '{print $1}'`
    pswd=`echo$line| awk '{print $2}'`
    plesk bin mail -c $email -passwd $pswd -mailbox true
    done <"$file"
    0
  • Hello Roger,

    The link has been updated. Thank you for bringing this to our attention!

    0

Please sign in to leave a comment.