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

  • setting the relaying mode for the mail server
  • setting the maximum message size that can be accepted by the mail server
  • enabling, disabling, and configuring spam protection service
  • enabling, disabling, and configuring outgoing mail control service
  • setting the IP address for outgoing mail
  • managing mail server black and white lists

Usage

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:

plesk bin 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.

If parameter auth is used, requires the -auth-type opion.

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

plesk bin mailserver --set-relay auth -auth-type both

--set-max-letter-size <number>[B|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:

plesk bin mailserver --set-max-letter-size 2M

--set-max-connections <number> Limits the number of concurrent connections to the mail server.

To limit the number of concurrent connections to the mail server to 100:

plesk bin mailserver --set-max-connections 100

--set-max-connections-per-ip <number> Limits the number of concurrent connections to the mail server from a single IP address.

To limit the number of concurrent connections to the mail server from a single IP address to 5:

plesk bin mailserver --set-max-connections-per-ip 5

--set-maps-status true|false Enables/Disables MAPS (Mail Abuse Prevention System) spam protection.

To enable MAPS spam protection on the mail server:

plesk bin mailserver --set-maps-status true

--add-maps-zone <zone1>,<zone2>...<zoneN> 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:

plesk bin mailserver --add-maps-zone maps1.example.com,maps2.example.com

--set-maps-zone <zone1>,<zone2>...<zoneN> Enables/Disables MAPS spam protection for one or more domain names.

To enable MAPS spam protection for domain names maps1.example.com and maps2.example.com:

plesk bin mailserver --set-maps-zone maps1.example.com,maps2.example.com

--remove-maps-zone <zone1>,<zone2>...<zoneN> 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:

plesk bin 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:

plesk bin 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:

plesk bin 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:

plesk bin 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:

plesk bin 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:

plesk bin mailserver --add-to-white-list 192.0.2.0/24,10.0.0.0/24

--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:

plesk bin mailserver --remove-from-white-list 192.0.2.0/24,10.0.0.0/24

--set-virusfilter none|drweb|kav Enables and specifies an antivirus used on the mail server: Odin Premium antivirus (drweb), Kaspersky antivirus (kav), or disables using antivirus on the mail server (none).

To enable the Odin Premium antivirus on the mail server:

plesk bin mailserver --set-virusfilter drweb

--update-spf  

Updates the Sender Policy Framework (SPF) settings.

Note: SPF cannot be disabled if DMARC spam protection is enabled.

To enable the SPF spam protection on the mail server:

plesk bin mailserver --update-spf -spf-status true

–enable-dmarc  

Enables DMARC spam protection.

Note: This command can be used only if DKIM and SPF spam protection are enabled. Otherwise, the error message will be displayed.

To enable DMARC spam protection for incoming mail on the mail server:

plesk bin mailserver --enable-dmarc

–disable-dmarc   Disables DMARC spam protection.

To disable DMARC spam protection for incoming mail on the mail server:

plesk bin mailserver --disable-dmarc

--set-message-submission true|false Defines whether the mail messages sent through the server are submitted or not.

To enable message submission on all IP addresses:

plesk bin mailserver --set-message-submission true

--sign-outgoing-mail true|false

Allows/Prohibits using DKIM spam protection method to sign outgoing mail.

Is false by default.

To enable signing of outgoing mail on the mail server:

plesk bin mailserver --sign-outgoing-mail true

--verify-incoming-mail true|false

Allows/Prohibits using DKIM spam protection method to verify incoming mail.

Is false by default.

Note: DKIM cannot be disabled for incoming mail if DMARC spam protection is enabled.

To enable verifying incoming mail on the mail server:

plesk bin mailserver --verify-incoming-mail true

--update-webmail horde|roundcube

Enables/Disables the selected webmail client.

Requires the -state option.

To enable Horde webmail on the mail server:

plesk bin mailserver --update-webmail horde -state true

--info or -i options|black-list|white-list|spf|webmails

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.
  • webmail - displays the webmail software used in Plesk and its status.

To view the SPF settings:

plesk bin mailserver --info spf

or

plesk bin mailserver -i spf

--clean-mail-queue   Removes the messages in the mail queue.

To remove the messages in the mail queue:

plesk bin mailserver --clean-mail-queue

--add-external-webmail  

Registers an additional (external) webmail service with the Plesk so that you can provide your users with access to it.

Requires the -webmail-name and the -webmail-url options.

To learn more about registering additional webmail services with the Plesk, refer to Administrator’s Guide at http://docs.plesk.com/en-US/17.0/administrator-guide/mail/webmail-software

To register an external webmail service called ExampleMail at URL mail.example.com:

plesk bin mailserver --add-external-webmail -webmail-name ExampleMail -webmail-url mail.example.com

--update-external-webmail <service name> Updates information about an additional webmail service.

To change the URL for the webmail record ExampleMail to mail2.example.com:

plesk bin mailserver --update-external-webmail "ExampleMail" -webmail-url mail2.example.com

To change the name for the external webmail service ExampleMail to SampleMail:

plesk bin mailserver --update-external-webmail "ExampleMail" -webmail-name "SampleMail"

--remove-external-webmail <service name> Removes registration of an additional webmail service.

To remove the external webmail service record ExampleMail:

plesk bin mailserver --remove-external-webmail "ExampleMail"

--update-smtp-settings  

Updates the settings of an external SMTP server for outgoing mail.

Note that to use an external SMTP server, you should install a special client through Tools & Settings > Updates and Upgrades > Mail hosting features > Different mail servers.

To update the external SMTP server settings:

plesk bin mailserver --update-smtp-settings -mail-notifications true -smtp-host 123.123.123.123 -smtp-port 587 -smtp-login jdoe -smtp-password sample -smtp-tls true -smtp-allow-users true

--enable-outgoing-antispam   Switches on limits on outgoing email messages.

To turn on the usage of limitations on outgoing mail from the Plesk server:

plesk bin mailserver --enable-outgoing-antispam

--disable-outgoing-antispam   Switches off limits on outgoing email messages.

To turn off the usage of limitations on outgoing mail from the Plesk server:

plesk bin mailserver --disable-outgoing-antispam

--set-outgoing-messages-mbox-limit <number> Sets the maximum number of outgoing messages from a mailbox (per hour) that Plesk will use by default.

To set the default value for the limit on outgoing email messages from an email address:

plesk bin mailserver --set-outgoing-messages-mbox-limit 5

--set-outgoing-messages-domain-limit <number> Sets the maximum number of outgoing messages from a domain (per hour) that Plesk will use by default.

To set the default value for the limit on outgoing email messages from a domain:

plesk bin mailserver --set-outgoing-messages-domain-limit 10

--set-outgoing-messages-subscription-limit <number> Sets the maximum number of outgoing messages from a subscription (per hour) that Plesk will use by default.

To set the default value for the limit on outgoing email messages from a subscription:

plesk bin mailserver --set-outgoing-messages-subscription-limit 50

--set-outgoing-messages-enable-sendmail true | false Sets the default value (on or off) for Linux sendmail for PHP scripts. Scripts will be able to send mail even when the limits on outgoing messages are reached for the corresponding mailbox and domain.

To prohibit PHP scripts send outgoing mail from the Plesk server using sendmail:

plesk bin mailserver --set-outgoing-messages-enable-sendmail false

--set-outgoing-messages-report-period <P1D|P1W|P2W|P1M> Sets the default period of time for the alert on the Plesk Home page about attempts to exceed limits on outgoing mail (the last day, week, two weeks, or month).

To make Plesk calculate reports on outgoing mail using the data for the last two weeks:

plesk bin mailserver --set-outgoing-messages-report-period P2W

--set-outgoing-messages-notification-period <PT15M|PT1H|PT6H|PT12H|P1D> Sets the default period of time for email notifications about attempts to exceed limits on outgoing mail (15 minutes, 1 hour, 6 hours, 12 hours,1 day).

To make Plesk send notifications to administrator on outgoing mail every 6 hours:

plesk bin mailserver --set-outgoing-messages-notification-period PT6H

--set-outgoing-email-mode domain_ip|domain-name|<explicit IP address>

If you use Postfix, you can set outgoing mail mode, which means IP addresses that Plesk uses to send mail from. By default, mail from each domain is sent using the domain’s IP address (the domain-ip value).

If domain IP addresses are used to send mail, you can make Plesk use the domain names in SMTP greeting, by using the domain-name value.

If you need Plesk to send all mail from one IP address, use <explicit IP address> and corresponding options (-explicit-ipv4 and -explicit-ipv4)

To make Plesk use domain names in SMTP greetings:

plesk bin mailserver --set-outgoing-email-mode domain-name

To make Plesk send all mail from the IP address 10.0.0.1:

plesk bin mailserver --set-outgoing-email-mode explicit-ip -explicit-ipv4 10.0.0.1

--set-certificate <certificate name> Specifies the name of the SSL/TLS certificate used to secure the mail server.

To secure the mail server with the SSL/TLS certificate cert3 that is stored at the repository of the domain example.net:

# plesk bin mailserver --set-certificate "cert3" -certificate-repository example.net

-certificate-repository <domain-name>

Specifies the domain of the SSL/TLS certificate repository. By default, the server repository is used.

This option is used with the command -set-certificate.

 
--help or -h   Displays help on the use of the utility.

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

plesk bin mailserver --help

or

plesk bin mailserver -h

Options

Option Parameter Description Example
-auth-type pop3|smtp|both

Specifies mail user authorization type during mail relaying.

Used with the --set-relay command only.

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

plesk bin 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.

Note: SPF cannot be disabled if DMARC spam protection is enabled.

To enable the SPF spam protection on the mail server:

plesk bin mailserver --update-spf -spf-status true

-spf-behavior true|false<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”:

plesk bin mailserver --update-spf -spf-behavior 3

-spf-rules <string>

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

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

Used only with the --update-spf command.

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

plesk bin mailserver --update-spf -spf-rules "include:spf.trusted-forwarder.org"

-spf-guess <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 - “iv=spf1 +a/24 +mx/24 +ptr ?all”:

plesk bin mailserver --update-spf -spf-guess "v=spf1 +a/24 +mx/24 +ptr ?all"

-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”:

plesk bin mailserver --update-spf -spf-exp "You message does not conform to the SPF policies"

-spf-ignore-dns-error true|false

Specifies whether SPF checking should continue or stop when there are DNS lookup problems on the mail server.

Used only with the --update-spf command.

To continue SPF checking when there are DNS lookup problems on the mail server:

plesk bin mailserver --update-spf -spf-status true -spf-ignore-dns-error true

-state true|false

Enables/Disables the selected webmail client.

Required for the --update-webmail command.

To enable Atmail webmail on the mail server:

plesk bin mailserver --update-webmail atmail -state true

-webmail-name <service name> Specifies the name for an external webmail service.

To register an external webmail service called ExampleMail at URL mail.example.com:

plesk bin mailserver --add-external-webmail -webmail-name ExampleMail -webmail-url mail.example.com

-webmail-url <URL for access to the service> Specifies the URL for an external webmail service.  
-webmail-status enabled|disabled Specifies whether the additional (external) webmail is available for selection in hosting plans.

To temporarily remove the ExampleMail webmail option from hosting plans:

plesk bin mailserver --update-external-webmail "ExampleMail" -webmail-status disabled

-explicit-ipv4 <IPv4 address> Specifies the IPv4 address from which Plesk will send all mail.

To make Plesk send all mail from the IP address 10.0.0.1

plesk bin mailserver --set-outgoing-email-mode explicit-ip -explicit-ipv4 10.0.0.1

-explicit-ipv6 <IPv6 address> Specifies the IPv6 address from which Plesk will send all mail.  
-smtp-host <domain|IP address> Sets the host name or IP address of the external SMTP server for outgoing mail.

To update the external SMTP server settings:

plesk bin mailserver --update-smtp-settings -mail-notifications true -smtp-host 123.123.123.123 -smtp-port 587 -smtp-login jdoe -smtp-password sample -smtp-tls true -smtp-allow-users true

-smtp-port

<port> Sets the port for the external SMTP server for outgoing mail.  
-smtp-login <login_name> Sets the username for accessing the external SMTP server for outgoing mail.  
-smtp-password <pasword> Sets the password for accessing the external SMTP server for outgoing mail.  
-mail-notifications true|false Allows Plesk to send email notifications through the specified SMTP server.  
-smtp-tls true|false Specifies whether the external SMTP server requires encrypted connections.  
-smtp-allow-users true|false Allows users’ scripts to send mail through the external SMTP server.