• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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