In this article, we'll cover three methods to create an email account in Plesk: via the Plesk dashboard, command-line interface (CLI), and REST API. Follow the steps below depending on your preferred method.
Pre-requirements
- Plesk account login credentials
- Access to the Plesk server (via SSH or RDP for CLI and API methods)
- Mail management enabled in the Plesk server settings
Method 1: Creating an Email Account via Plesk Dashboard
- Log in to Plesk.
- Navigate to Domains > example.com > Email Addresses.
- Click Create Email Address.
- Fill in the necessary fields (e.g., email address and password).
- Leave the Mailbox checkbox selected if you want to create a mailbox for this email address.
- If you only need a mail forwarder (without a mailbox), uncheck the Mailbox option.
- Click OK to create the email account.
Note: If "Email Addresses" and "Email Settings" options are hidden, mail management may be disabled server-wide. Ensure mail services are enabled to proceed.
Method 2: Creating an Email Account via Command-Line Interface (CLI)
To create an email account using the command-line interface, follow these steps:
- Connect to your Plesk server via SSH (Linux) or RDP (Windows Server).
- Run the following command to create a new email account:
plesk bin mail --create john_doe@example.com -passwd "your_password" -mailbox true
- Replace john_doe@example.com with the actual email address and "your_password" with the desired password.
- To list all existing email accounts, run this command:
plesk bin mail --list
Method 3: Creating an Email Account via REST API
If you prefer to create an email account using the Plesk REST API, follow these steps:
Step 1: Generate an API Key
- Connect to your Plesk server via SSH (Linux) or RDP (Windows Server).
- Run the following command to generate an API key:
curl -k -X POST --user admin:"$password" -H "Content-Type: application/json" -H "Accept: application/json" -d"{}" "https://203.0.113.2:8443/api/v2/auth/keys"
- Alternatively, use the Plesk command:
plesk bin secret_key -c