• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Automatically create some other folders in Maildir when mailbox is created

Thomas Becker

Basic Pleskian
Hello,
when a new mailbox is created with Plesk, Plesk does also create a folder ".Spam" in folder "Maildir".
Where is the config file or skeleton for doing this?

I want to have some other folders to be created automatically when a new mailbox is created. For example Trash, Draft, Sent

This is important because for example Outlook does not create IMAP folders automatically and many customers getting warn messages from Outlook that the sent mail could not be stored in the respective folder. It is very annoying and uncomfortable for customers to create such folders manually.

Thanks for help.

Regards
Thomas
 
Last edited:
Yes, I also have this issue.

My work around is asking clients to login to their webmail initially to change their mailbox password to their own. I have configured RoundCube to create these folders on first login.

Not sure if the stock webmail systems can be configured with the same action though...
 
I am not using Plesk 11 but I have set this up in older versions.

Create this script on the server and make it executable ( I created mine here: /usr/local/psa/bin/newmailboxfolders.sh )

----------------------------------------------------
#!/bin/bash

mail=${NEW_MAILNAME}
domain=${mail##*@}
name=${mail%@*}

echo "--------------" >> /tmp/event_handler.log

/bin/date >> /tmp/event_handler.log # information on the event date and time

/usr/bin/id >> /tmp/event_handler.log # information on the user, on behalf of which the script was executed (to ensure control)

echo "mail account created" >> /tmp/event_handler.log # information on the created email account

echo "mailbox name: ${NEW_MAILNAME}" >> /tmp/event_handler.log

echo "creating Maildir folders - sent, drafts, trash" >> /tmp/event_handler.log
maildirmake -f Sent /var/qmail/mailnames/$domain/$name/Maildir
maildirmake -f Drafts /var/qmail/mailnames/$domain/$name/Maildir
maildirmake -f Trash /var/qmail/mailnames/$domain/$name/Maildir

echo "--------------" >> /tmp/event_handler.log
----------------------------------------------------

Then add a new Event Handler in the plesk panel

Event: Mail account created
Priority: 0
User: root
Command: /usr/local/psa/bin/newmailboxfolders.sh
 
Last edited:
Used this script and is very useful however the user needs to be set to popuser else all folders belong to root and the client can't access them.
 
Back
Top