Applicable to:
- Plesk for Linux
Question
How to create a new IMAP INBOX subfolder via command line on Linux?
Answer
Example below demonstrates how to create a folder named newfolder for mailbox email@example.com
-
Connect to the server over SSH
-
Check what IMAP server is used:
# command -v doveadm >/dev/null && echo 'Dovecot' || echo 'Courier IMAP'
-
Create the mail folder:
If Dovecot is used on the serverCreate the folder using the doveadm utility:
# doveadm mailbox create -u email@example.com -s INBOX.newfolder
If Courier IMAP is used on the server-
Manually create directories required for the mail folder:
# mkdir -p /var/qmail/mailnames/example.com/email/Maildir/.newfolder/{new,cur,tmp}
-
Add a flag to indicate that this is a mail folder:
# touch /var/qmail/mailnames/example.com/email/Maildir/.newfolder/maildirfolder
-
Make the folder visible to the user (subscribe to the folder) by adding it to subscriptions list:
# echo newfolder >> /var/qmail/mailnames/example.com/email/Maildir/subscriptions
-
Restore directory's permissions:
# chown -R popuser.popuser /var/qmail/mailnames/example.com/email/Maildir/.newfolder
-
Comments
2 comments
If you are using Dovecot, you can do the same thing with a single command:
# doveadm mailbox create -u username@example.com -s INBOX.newfolder
@Larry Nedry
Thank you for the suggestion! The solution was added to the article
Please sign in to leave a comment.