mail.exe: Mail Accounts

The mail.exe utility serves to manage mail accounts. The utility allows the following operations:

  • creating and removing mail accounts
  • modifying mail account settings (mailbox quotas, antivirus protection, etc.)
  • managing autoresponders (mail reply messages to be sent automatically), mail redirection, and mail aliases
  • enabling/disabling the mail service on subscriptions
Location

%plesk_cli%

Usage
mail.exe <command> [[<mail name>@]<domain name>] [
<option 1> <param 1>[,<param 2>,...,<param n>]
[<option 2> <param 1>[,<param 2>,...,<param n>]]
... [<option N> <param 1>[,<param 2>,...,<param n>]]
]

 

Example

The following command creates the JohnDoe@example.com mail account, sets the password MyPass for it, restricts the size of the mailbox to 10240 KB, and enables bidirectional mail checkup for viruses.

mail.exe --create JohnDoe@example.com -passwd MyPass -mbox_quota 10240K -antivirus inout

 

Commands
Command Parameter Description Example

--create or -c

<mail name>@<domain name>

Creates a mail account with a specified name.

To create a mail account with the name JohnDoe on the domain example.com:

mail.exe --create JohnDoe@example.com

or

mail.exe -c JohnDoe@example.com

--update or -u

<mail name>@<domain name>

Updates mail account settings.

To set the size of the mailbox for JohnDoe@example.com:

mail.exe --update JohnDoe@example.com -mbox_quota 20480K

or

mail.exe -u JohnDoe@example.com -mbox_quota 20480K

--update-service

<domain_name>

Switches mail service on or off on a subscription.

Requires the -status option.

To enable mail service on the subscription example.com:

mail.exe --update-service example.com -status enabled

--rename

<email>

Renames a mail account.

Required option -new.

To rename mail account JDoe@example.com to roy@example.com:

mail.exe --rename JDoe@example.com -new roy

--list or -l

 

Retrieves the list of email accounts.

To see the list of email accounts:

mail.exe -l

--remove or -r

<mail name>@<domain name>

Removes a specified mail account from a domain.

To remove the mail account with the name JohnDoe from example.com:

mail.exe --remove JohnDoe@example.com

or

mail.exe -r JohnDoe@example.com

--on

<domain name>

Enables mail service on a subscription.

To enable the mail service on the subscription example.com:

mail.exe --on example.com

--off

<domain name>

Disables mail service on a subscription.

To disable the mail service on the subscription example.com:

mail.exe --off example.com

--info or -i

<mail name>@<domain name>

Retrieves info about a specified mail account.

To retrieve info about the mail account JohnDoe@example.com:

mail.exe --info JohnDoe@example.com

or

mail.exe -i JohnDoe@example.com

--help or -h

 

Displays help on the use of the utility.

To see the help info on the use of the utility:

mail.exe --help

or

mail.exe -h

Options
Option Parameter Description Example

-manage-virusfilter

true|false

Allows or prohibits managing the antivirus settings.

To allow managing the antivirus settings for the mail account JDoe@example.com:

mail.exe -u JDoe@example.com -manage-virusfilter true

-manage-spamfilter

true|false

Allows or prohibits managing the spam filter settings.

To allow managing the spam filter settings for the mail account JDoe@example.com:

mail.exe -u JDoe@example.com -manage-spamfilter true

-mailbox

true|false

Creates/Removes a mailbox.

Is false by default.

To create a mailbox for JohnDoe@example.com mail account:

mail.exe --update JohnDoe@example.com -mailbox true

-passwd

<password>

Sets a password.

To set the 12345 password for JohnDoe@example.com mail account:

mail.exe --update JohnDoe@example.com -passwd 12345

-passwd_type

plain|encrypted

Specifies the type of user password.

Ignored if no password is specified.

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

mail.exe -u JDoe@example.com -passwd_type encrypted -passwd '$1$3KWwrPxB$b6GLpDPpQVsljMRgAlQZG/'

-mbox_quota

<number>[B|K|M|G|T]

Limits the size of the mailbox.

To restrict the size of the mailbox for JohnDoe@example.com mail account to 10240 KB:

mail.exe --update JohnDoe@example.com -mbox_quota 10240K

-aliases

add|del:<name1[,name2]>

Adds/Deletes mail aliases.

To add JD, JohnD mail aliases to JohnDoe@example.com mail account:

mail.exe --update JohnDoe@example.com -aliases add:JD,JohnD

-mgroups

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

Adds a mail account to or removes a mail account from a mail group.

To add mail account JDoe@example.com to the mail group testgroup:

mail.exe -u JDoe@example.com -mgroups add:testgroup

-forwarding

true|false

Enables/Disables mail forwarding for a mail account.

Is false by default.

To enable mail forwarding from John_Doe@example.com to John_Doe@sample.com:

mail.exe --update John_Doe@example.com -forwarding true -forwarding-addresses add:John_Doe@sample.com

 

-forwarding-addresses

add|del: <address 1>, <address 2>

Specifies e-mail addresses to which incoming mail should be forwarded.

It is required when enabling the -forwarding option for a mail account.

-status

enabled|disabled|admin,domadm,parent,client

Enables/Disables mail service on a subscription (the enabled or disabled parameters, respectively).

To enable mail service on the subscription example.com:

mail.exe --update-service example.com -status enabled

-new

<string>

Specifies new mail account name.

Used with --rename only.

To rename mail account JDoe@example.com to rroy@example.com:

mail.exe --rename JDoe@example.com -new rroy

-cp-access

true|false

Allows or prohibits logging in to the Control Panel with the specified email address as the username.

This option, if 'true', creates an auxiliary user with the specified email address as the user name and gives this user access to the Control Panel.

To prohibit the corresponding existing user from logging in the the Control Panel, use 'false'.

To create the mail account user4@ example.com and the auxiliary user and to allow the user to log in to Control Panel with the email address as the user name and the password mypassword:

mail.exe --create user4@example.com -passwd mypassword -cp-access true -mailbox true

 

To update the existing mail account user2@ example.com and create the auxiliary user who can log in to Control Panel with the email address as the user name and the password mypass:

mail.exe --update user2@example.com -passwd mypass -cp-access true -mailbox true

-description

<string>

Specifies a description of an email address to be displayed in Plesk.

 

To create a description of the mail account JDoe@example.com:

mail.exe --update JDoe@example.com -description "A mailbox for JDoe"

-json

 

Displays the output in the JSON format. Used with the --list command.

To see the list of mail accounts in the JSON format:

mail.exe -l -json

-antivirus

off|inout|in|out

Sets an antivirus checkup of the mail traffic.

One can disable this option, or enable this checkup for the incoming mail only, or for the outgoing mail only, or for both.

To enable the antivirus checkup for all mail messages sent to JohnDoe@example.com:

mail.exe --update JohnDoe@example.com -antivirus in

-antivirus-incoming

true|false|server_wide

Manages antivirus checking for incoming mail traffic. You can switch it on and off for the whole server and for individual mailboxes.

To enable the antivirus checkup for all incoming mail messages sent to JohnDoe@example.com:

mail.exe --update JohnDoe@example.com -antivirus-incoming true

-antivirus-outgoing

true|false|server_wide

Manages antivirus checking for outgoing mail traffic. You can switch it on and off for the whole server and for individual mailboxes.

To enable the antivirus checkup for all outgoing mail messages sent to JohnDoe@example.com:

mail.exe --update JohnDoe@example.com -antivirus-outgoing true

-outgoing-messages-mbox-limit

<number>|default

Sets the limit on outgoing messages from a mailbox (per hour).

To set the Unlimited value, specify "-1". Specify "default" to set the value specified in server-wide settings.

To set the limit on outgoing messages per hour from the email address JDoe@example.com:

mail.exe --update JohnDoe@example.com -outgoing-messages-mbox-limit 12