Mail Accounts: mail Utility

The mail utility is used to manage domain mail service and mail names (email accounts) through CLI. By using this utility, you can perform the following tasks:

Syntax

mail <command> [<mail_name>] [
<option_1> [<param>]
[<option_2> [<param>]]
… [<option_N> [<param>]]
]

Example

The following command creates mail account JDoe@example.com, sets password mypass for it, disables Plesk GUI access to this mail account, sets the size of the email box to 50 MB, and enables the antivirus screening of both incoming and outgoing email messages for the mail account.

# ./mail --create JDoe@example.com -passwd mypass -cp-access false -mbox_quota 50M -antivirus inout

Commands

Command

Parameter

Description

Example

--create or -c

<email>

Creates a Plesk mail account.

To create the mail account JDoe@example.com:

# ./mail --create JDoe@example.com

or

# ./mail -c JDoe@example.com

--update or -u

<email>

Updates a mail account settings.

To set the size of the email box for mail account JDoe@example.com to 50 MB:

# ./mail --update JDoe@example.com -mbox_quota 50M

or

# ./mail -u JDoe@example.com -mbox_quota 50M

--update-service

<domain_name>

Updates mail service status on a domain.

Requires the -status option.

To enable mail service on the domain example.com:

# ./mail --update-service example.com -status enabled

--remove or -r

<email>

Deletes a mail account.

To delete mail account JDoe@example.com:

# ./mail --remove JDoe@example.com

or

# ./mail -r JDoe@example.com

--on

<domain_name>

Enables email service on a domain.

To enable email service on the domain example.com:

# ./mail --on example.com

--off

<domain_name>

Disables email service on a domain.

To disable email service on the domain example.com:

# ./mail --off example.com

--info or -i

<email>

Displays information about a mail account.

To view information about mail account JDoe@example.com:

# ./mail --info JDoe@example.com

or

# ./mail -i JDoe@example.com

--help or -h

 

Displays help on the use of the utility.

To view help on the use of the autoresponder utility:

# ./mail --help

or

# ./mail --h

Options

Option

Parameter

Description

Example

-cp_access

true|false

Allows/Prohibits accessing Plesk GUI (as opposite to using Plesk API).

Is true by default.

Deprecated. Use -cp-access instead.

To prohibit JDoe@example.com from accessing to Plesk GUI:

# ./mail -u JDoe@example.com -cp_access false

-cp-access

true|false

Allows/Prohibits accessing Plesk GUI (as opposite to using Plesk API).

Is true by default.

To prohibit JDoe@example.com from accessing to Plesk GUI:

# ./mail -u JDoe@example.com -cp-access false

-mailbox

true|false

Creates/Removes a mailbox.

Is false by default.

To create mail box for a mail account JDoe@example.com:

# ./mail -u JDoe@example.com -mailbox true

-passwd

<password>

Sets the user password.

For additional comments, see the Note below the table.

To set the user password for the mail account JDoe@example.com to mypass:

# ./mail -u JDoe@example.com -passwd mypass

-passwd_type

plain|encrypted

Specifies the type of user password.

Ignored if no password is specified.

For additional comments, see the Note below the table.

To set the user password to sample and password type to encrypted for the mail account JDoe@example.com:

# ./mail -u JDoe@example.com -passwd_type encrypted -passwd sample

-mbox_quota

<number>[K|M|G]

Sets the size of the mailbox.

Default mailbox quota for a domain to which an account belongs, if set to -1.

Is the default for the domain value by default.

To set the mailbox quota for the mail account JDoe@example.com to 50 MB:

# ./mail -u JDoe@example.com -mbox_quota 50M

-aliases

add|del:<alias>[,<alias_1>,...,<alias_N>

Adds/Removes mail aliases.

To add mail aliases John and JohnDoe to mail account JDoe@example.com:

# ./mail -u JDoe@example.com -aliases add:John,JohnDoe

-mgroups

add|del:<mail_group>[,<mail_group_1>,...,<mail_group_N>

Adds/Removes a mail account to/from Plesk mail groups.

To remove JDoe@example.com from mail groups Partners and VIPs:

# ./mail -u JDoe@example.com -mgroups del:Partners,VIPs

-redirect

true|false

Allows/Prohibits redirecting mail messages.

If set to true, requires the -rediraddr option.

Is false by default.

To allow JDoe@example.com to redirect mail messages to email address JDoe@sample.com:

# ./mail -u JDoe@example.com -redirect true -rediraddr JDoe@sample.com

-rediraddr

<email>

Specifies an email address to which incoming mail will be forwarded upon receipt.

Required with -redirect if is set to true.

To set up redirecting mail for JDoe@example.com to email address John@example.com:

# ./mail -u JDoe@example.com -redirect true -rediraddr John@example.com

-group

true|false

Allows/Prohibits a mail group associated with a mail account.

To allow mail group associated with mail account JDoe@example.com:

# ./mail -u JDoe@example.com -group true

-groupmem

add|del:<email_1>[,<email_2>,...,<email_N>

Adds/Removes email addresses to/from a mail group associated with a mail account.

To add email addresses Jane@example.com and Mike@sample.com to the mail group associated with mail account JDoe@example.com:

# ./mail -u JDoe@example.com -groupmem add:Jane@example.com,Mike@example.org

-multiple-sessions

true|false

Allows/Prohibits multiple simultaneous sessions under mail user's login.

To allow multiple sessions to run simultaneously under mail user login JDoe@example.com:

# ./mail -u JDoe@example.com -multiple-sessions true

-locale

<language_code>

Specifies which language is used in a mail user's control panel interface.

The argument of the command must be a valid four-letter language code derived from the language code described in ISO-639-2 and the corresponding country code described in ISO-3166. For example, the Plesk code for the Italian language code is it-IT; the Plesk code for the American variant of English is en-US; the Plesk code for the British variant of English is en-GB.

To set the default interface language for mail user with login name JDoe@example.com to Russian:

# ./mail -u JDoe@example.com -locale -ru-RU

-max-button-length

<number>

Limits the button length (in symbols) for mail user's control panel interface.

To set the button label length for JDoe@example.com control panel interface to 20:

# ./mail -u JDoe@example.com -max-button-length 20

-lock-screen

true|false

Prevents/Allows working with Plesk until page is completely loaded.

Is true by default.

To allow JDoe@example.com to work with the control panel interface even if control panel screens are not completely loaded:

# ./mail -u JDoe@example.com -lock-screen false

-skin

<string>

Specifies the default skin for mail user's control panel interface.

To set the WinXP Olivegreen skin as the default interface skin for the JDoe@example.com:

# ./mail -u JDoe@example.com -skin "WinXP Olivegreen"

-status

enabled|disabled|admin,domadm,parent,client

Enables/Disables mail service on a domain (the enabled or disabled parameters, respectively). Disables domain mail service and sets the domain mail service status to Domain mail service is disabled by administrator (admin) or Domain mail service is disabled by client (client). Sets the domain mail service status to the status of the domain (parent).

The use of the domadm parameter is restricted; the parameter should not be used for changing the domain mail service status.

To enable mail service on domain example.com:

# ./mail --update-service example.com -status enabled

To set the status of mail service on domain example.com to the status of the domain:

./mail --update-service example.com -status parent

-manage-drweb

true|false

Allows/Prohibits managing Dr.Web antivirus application.

Deprecated since Plesk 8.1. Use -manage-drweb option instead.

To allow JDoe@example.com to manage Dr.Web antivirus application:

# ./mail -u JDoe@example.com -manage-drweb true

-manage-spamfilter

true|false

Allows/Prohibits managing spam filter.

To allow JDoe@example.com managing spam filter:

# ./mail -u JDoe@example.com -manage-spamfilter true

-antivirus

off|inout|in|out

Disables (off) or enables (in, out, inout) antivirus screening of e-mail messages for a mail name. Sets the mode of antivirus screening:

  • in - only incoming messages are screened
  • out - only outgoing messages are screened
  • inout - both incoming and outgoing messages are screened

To enable the antivirus screening for all incoming e-mail messages addressed to JDoe@example.com:

# ./mail -u JDoe@example.com -antivirus in

Note: Use of this option is not recommended. Passing passwords through CLI as parameters of the -passwd option may potentially compromise the system's security as command line can be observed by other users of the system. It is more secure to pass passwords through the environment variables. You can transfer non-encrypted passwords by using environment variable PSA_PASSWORD while using single quotes to specify the empty values in the command line for the argument of the -passwd - -passwd_type options.
Similarly, you can transfer encrypted passwords through the environment variable PSA_CRYPTED_PASSWORD while using single quotes to specify the empty values in the command line for the argument of the -passwd and -passwd_type options.