Applicable to:
- Plesk for Linux
Question
By default, Plesk stores all mailboxes in the directory /var/qmail/mailnames/. How to change this location?
Answer
Limitations:
- Capital letters must not be used in the name of the directory that will be used as the new location for mailboxes.
- 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.
- The directory /var/qmail/mailnames should not be removed. Only domains' directories can be removed or moved out from there if necessary.
- Changing the mailboxes location on Plesk servers with Plesk Premium Email installed is currently not supported. Such a possibility will be added in the future.
-
Connect to the server via SSH
-
Stop the SMTP service:
# systemctl stop postfix
-
Update
PLESK_MAILNAMES_Dvalue in/etc/psa/psa.confto the new location (replace <new_directory> with new mailbox location path):# sed -i 's|/var/qmail|<new_directory>|g' /etc/psa/psa.conf
-
Copy the current mailboxes directory to the new mailboxes directory:
# cp -ap /var/qmail/mailnames <new_directory>
-
Update the configuration of the IMAP/POP3 server:
Dovecot-
Create a new custom configuration file to set new location variables (replace <new_directory> with new mailbox location path):
-
If Plesk version is 18.0.72 or lower:
# { grep '^mail_home =' /etc/dovecot/dovecot.conf; grep '^mail_location =' /etc/dovecot/dovecot.conf | sed 's/$/:UTF-8/'; } | sed 's|/var/qmail|<new_directory>|g' > /etc/dovecot/conf.d/99-custom_dir.conf
-
If Plesk version is 18.0.73 or higher:
# { grep '^mail_home =' /etc/dovecot/dovecot.conf; grep '^mail_path =' /etc/dovecot/dovecot.conf; } | sed -e 's|/var/qmail|<new_directory>|g' -e '/lower/! s/}/ | lower}/g' > /etc/dovecot/conf.d/99-custom_dir.conf
-
-
Restart Dovecot and pc-remote services:
# systemctl restart dovecot pc-remote
Courier-IMAPRestart all Courier services:
# systemctl restart courier-authdaemon courier-imapd courier-imaps courier-pop3d courier-pop3s
Note: To check which IMAP/POP3 server is being used:
1. Log into Plesk
2. Go to Tools & Settings > Mail Server Settings: -
-
Start SMTP service:
# systemctl start postfix
-
Reconfigure mail services:
# plesk repair mail -y
-
Set the new home directory for the user
popuser:# usermod -m -d <new_directory>/popuser popuser
-
If server is using CentOS/RHEL/AlmaLinux, configure SELinux for new location:
# chcon -R -t mail_spool_t <new_directory>/mailnames
Comments
ATTENTION: It's necessary to set SELinux to permissive as described here before https://support.plesk.com/hc/en-us/articles/12377675193879-How-to-enable-disable-SELinux-on-a-server
Hi, is this also possible on mailbox level? Or only "all or nothing"?
One Customer has huge Amount of Mails, he wants to mount that on other storage.
Plesk has upgraded dovecot to 2.4 in Plesk 18.0.73.
dovecot 2.4 heavily changes config params included mail_location.
This article must be updated with the following path:
Instead of mail_location:
mail_path = /XXX/XXX/qmail/mailnames/%{user | domain}/%{user | username}/Maildir
Removing also :UTF8 param
Please sign in to leave a comment.