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


2016-11-16 12:50:44 UTC


2017-07-14 09:57:16 UTC


Was this article helpful?

Have more questions?

Submit a request

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

Applicable to:

  • Plesk for Linux


By default, Plesk stores all mailboxes in the /var/qmail/mailnames/ directory. How to change this location?


  1. Find what SMTP and IMAP/POP3 servers are in use:

    # /usr/local/psa/admin/bin/mailmng --features | egrep 'SMTP_Server|IMAP_POP3_Server'
    $features['SMTP_Server'] = "postfix";
    $features['IMAP_POP3_Server'] = "Courier-IMAP";
  2. Stop the SMTP service:

    # service postfix stop
  3. Open the file /etc/psa/psa.conf and change the PLESK_MAILNAMES_D variable: specify a new location for mailbox directory:

    # grep PLESK_MAILNAMES_D /etc/psa/psa.conf
    PLESK_MAILNAMES_D <new_mailnames_directory>
    Note: To avoid performance degradation, the new location for the mailboxes directory should be located in the local file system - it should not be mounted as a network share, such as NFS.
  4. Move mailboxes from the current directory to the new location with the command:

    # cp -ap /var/qmail/mailnames/* <new-mailnames-directory>
  5. If dovecot is in use, set the new location in the file /etc/dovecot/dovecot.conf by modifying values in the lines below:

    # egrep 'mail_home|mail_location' /etc/dovecot/dovecot.conf
    mail_home = <new_mailnames_directory>/%Ld/%Ln
    mail_location = maildir:<new_mailnames_directory>/%Ld/%Ln/Maildir
  6. Restart the dovecot service:

    # service dovecot restart
  7. After all the steps are done, start SMTP service and reconfigure mail settings using the mchk utility:

    # service postfix start
    # /usr/local/psa/admin/sbin/mchk --with-spam
  8. Before creating new mailboxes on new domains make sure SELinux is configured properly, otherwise the following error may appear upon mailbox creation:

    Cannot open file `.qmail' to read: Permission denied
Have more questions? Submit a request
Please sign in to leave a comment.