How to change location of the directory with mailboxes in Plesk for Linux?

Created:

2016-11-16 12:50:44 UTC

Modified:

2017-05-25 18:43:05 UTC

3

Was this article helpful?


Have more questions?

Submit a request

How to change location of the directory with mailboxes in Plesk for Linux?

Applicable to:

  • Plesk for Linux

Question

Plesk stores email messages in the /var/qmail/mailnames/ directory. The partition where /var is located does not have enough disc space. How to change location of the directory with mailboxes?

Answer

There is PLESK_MAILNAMES_D variable in /etc/psa/psa.conf Plesk's configuration file. This variable defines the location, where mail server should store mailboxes:

[root@server ~]# grep PLESK_MAILNAMES_D /etc/psa/psa.conf
PLESK_MAILNAMES_D /var/qmail/mailnames
  1. Determine what mail server is used:

    [root@server ~]# /usr/local/psa/admin/bin/mailmng --features | grep 'SMTP_Server\\|IMAP_POP3_Server'
    $features['SMTP_Server'] = "postfix";
    $features['IMAP_POP3_Server'] = "Courier-IMAP";
    ...
  2. Stop the following services (example with postfix as a mail server is used):

    # /etc/init.d/postfix stop
  3. Open the /etc/psa/psa.conf file and change PLESK_MAILNAMES_D variable. Specify the new location for email messages directory:

Note: only the PLESK_MAILNAMES_D variable should be changed in /etc/psa/psa.conf file. No other changes should be done.

    PLESK_MAILNAMES_D <new-mailnames-directory>

**Note:** in order to avoid sufficient performance degradation, the new location for the email messages directory should be located in the local file system. It should not be mounted as a network share (NFS, for example).
  1. Move mailboxes from current directory to the new location:

    # cp -ap /var/qmail/mailnames/* <new-mailnames-directory>
  2. In case of using dovecot , set the new location in file /etc/dovecot/dovecot.conf for these lines:

    # Plesk Maildirs layout.
    mail_home = /var/qmail/mailnames/%Ld/%Ln
    mail_location = maildir:/var/qmail/mailnames/%Ld/%Ln/Maildir

    and restart the service:

    # service dovecot restart
  3. After moving mailbox content, start services that were stopped previously and reconfigure mail settings using 'mchk' utility:

    # /etc/init.d/postfix start
    # /usr/local/psa/admin/sbin/mchk --with-spam
Have more questions? Submit a request
Please sign in to leave a comment.