Mail Server Settings: mailserver Utility

The mailserver utility is used to manage Plesk mail server settings through CLI. By using this utility, you can perform the following tasks:

Syntax

mailserver <command> [
<option_1> [<param>]
[<option_2> [<param>]]
… [<option_N> [<param>]]
]

Example

The following command sets the relaying mode that requires authorization, specifies the POP3 authorization type for mail users, and set the lock time to 10 minutes:

# ./mailserver --set-relay auth -auth-type pop3 -lock-time 10

Commands

Command

Parameter

Description

Example

--set-relay

closed|auth

Specifies the mail relay mode for the mail server.

To set the Plesk mail server relaying mode to "authorization is required" (auth):

# ./mailserver --set-relay auth

--set-max-letter-size

<number>[K|M|G]

Limits the maximum message size that can be accepted by the mail server.

To restrict the maximum message size that can be accepted by the mail server to 2 M:

# ./mailserver --set-max-letter-size 2M

--set-maps-status

true|false

Enables/Disables MAPS (Mail Abuse Prevention System) spam protection.

To enable MAPS spam protection on the mail server:

# ./mailserver --set-maps-status true

--add-maps-zone

<domain_name_1>[,<domain_name_2>,...<domain_name_N>]

Adds one or more domain names to the MAPS spam protection list.

To add domain names maps1.example.com and maps2.example.com to the MAPS spam protection list:

# ./mailserver --add-maps-zone maps1.example.com,maps2.example.com

--remove-maps-zone

<domain_name_1>[,<domain_name_2>,...<domain_name_N>]

Removes one or more domain names from the MAPS spam protection list.

To remove domain names maps1.example.com and maps2.example.com from the MAPS spam protection list:

# ./mailserver --remove-maps-zone maps1.example.com,maps2.example.com

--set-account-type

full|both

Specifies the mail user login name format for accessing mail accounts by means of the POP3 or IMAP protocols.

  • full - only login names in the <user@example.com> (the "full" format) are allowed
  • both - login names in both <user> (the "short" format) and <user@example.com> (the "full" format) are allowed

Is set to full by default.

To allow using both the "short" and "full" login name formats for mail users to access their mail accounts by means of the POP3 or IMAP protocols on the mail server:

# ./mailserver --set-account-type both

--use-vocabulary

true|false

Enables/Disables checking mail user passwords against the dictionary of simple passwords to prevent users from setting simple passwords.

To enable checking of mail user passwords against the password dictionary to prevent users from setting simple passwords:

# ./mailserver --use-vocabulary true

--add-to-black-list

<domain_name_1>[,<domain_name_2>,...<domain_name_N>]

Adds one or more domain names to the mail server black list.

To add domain names example.org and sample.example.net to the black list of mail server:

# ./mailserver --add-to-black-list example.org,sample.example.net

--remove-from-black-list

<domain_name_1>[,<domain_name_2>,...<domain_name_N>]

Removes one or more domain names from the black list of mail server.

To remove domain names sample.example.org and forum.example.net from the mail server black list:

# ./mailserver --remove-from-black-list sample.example.org,forum.example.net

--add-to-white-list

<IP address/subnet mask 1>[,<IP address/subnet mask 2>,...<IP address/subnet mask N>]

Adds one or more IP addresses/subnet masks to white list of the mail server.

To add 192.0.2.0/24 and 192.0.2.3/16 to the mail server white list:

# ./mailserver --add-to-white-list 192.0.2.0/24,192.0.2.3/16

--remove-from-white-list

<IP address/subnet mask 1>[,<IP address/subnet mask 2>,...<IP address/subnet mask N>]

Removes one or more subnet masks from the mail server white list.

To remove 192.0.2.0/24 and 192.0.2.4/16 from the mail server white list:

# ./mailserver --remove-from-white-list 192.0.2.0/24,192.0.2.4/16

--update-spf

 

Updates the Sender Policy Framework (SPF) settings.

To enable the SPF spam protection on the mail server:

# ./mailserver --update-spf -spf-status true

--sign-outgoing-mail

true|false

Allows/Prohibits using DomainKeys Spam protection to sign outgoing mail.

Is false by default.

Available since Plesk 8.4.

To enable signing on outgoing mail on the mail server:

# ./mailserver --sign-outgoing-mail true

--verify-incoming-mail

true|false

Allows/Prohibits using DomainKeys Spam protection to verify incoming mail.

Is false by default.

Available since Plesk 8.4.

To enable verifying incoming mail on the mail server:

# ./mailserver --verify-incoming-mail true

--info or -i

options|black-list|white-list|spf

Displays mail server settings. The following modes are available:

  • options - displays various mail server settings except for the mail server black and white lists contents and the Sender Policy Framework (SPF) settings.
  • black-list - displays the mail server black list content
  • white-list - displays the mail server white list content
  • spf - displays the SPF settings.

To view the SPF settings:

# ./mailserver --info spf

or

# ./mailserver -i spf

--help or -h

 

Displays help on the use of the utility.

To view the help on the use of the mailserver utility:

# ./mailserver --help

or

# ./mailserver -h

Options

Option

Parameter

Description

Example

-auth-type

pop3|smtp|both

Specifies mail user authorization type during mail relaying.

To set the relaying mode to authorization is required mode, to specify the both authorization type, and set the lock time to 10 min:

# ./mailserver --set-relay auth -auth-type both -lock-time 10

-lock-time

<minutes>

Specifies the lock time for POP3 authorization.

Required with -auth-type option when the pop3 or both parameter is set.

See Example above.

-spf-status

true|false

Enables/Disables the Sender Policy Framework (SPF) spam protection on the mail server.

Used only with the --update-spf command.

To enable the SPF spam protection on the mail server:

# ./mailserver --update-spf -spf-status true

-spf-behavior

<number>

Sets the SPF behavior. The following modes are available:

1 - only create Received-SPF headers, never block

2 - use temporary error notices when you have DNS lookup problems

3 - reject mails when SPF resolves to "fail" (deny)

4 - reject mails when SPF resolves to "softfail"

5 - reject mails when SPF resolves to "neutral"

6 - reject mails when SPF does not resolve to "pass"

Used only with the --update-spf command.

To set SPF behavior to reject mails when SPF resolves to "fail":

# ./mailserver --update-spf -spf-behavior 3

-spf-rules

<string>

Sets SPF rules that will be applied for domains which do not conform to the SPF policies.

Used only with the --update-spf command.

To set the following SPF rule - "include:spf.trusted-forwarder.org":

# ./mailserver --update-spf -spf-rules "include:spf.trusted-forwarder.org"

-spf-guess

<string>

Sets SPF rules that will be applied if SPF checks return "fail", "softfail", or "neutral".

Used only with the --update-spf command.

To set the following SPF rule - "include:spf.trusted-forwarder.org":

# ./mailserver --update-spf -spf-guess "include:spf.trusted-forwarder.org"

-spf-exp

<string>

Sets the message text that will be received by the sender (SMTP client) of a message rejected as a result of SPF check.

Used only with the --update-spf command.

To set the SPF explanation text to "You message does not conform to the SPF policies":

# ./mailserver --update-spf -spf-exp "You message does not conform to the SPF policies"