virtualmin option to create junk folder

in "virtualmin configuration -> actions upon server and user creation" i can set auto-create Trash, Drafts, Sent.

please add option for Junk too (for spam) and make /etc/procmailrc and per-site procmailrc scripts send spam to that folder (the "x-spam-status" test) instead of old "spam" folder...

I need my users to have "Junk" folder from day 1, immediately, so their mail clients detect antispam folder. all modern mail client like thunderbird and roundcube expect spam in ".Junk" not ".spam" and they also want tosee the folder exists immediately

for the moment i do this after i create any new user:

cp -Rp /home/[dom]/homes/[user]/Maildir/.Sent /home/[dom]/homes/[user]/Maildir/.Junk

please add this option.

Status: 
Closed (fixed)

Comments

this also remind me...

when you create a new domain, the admin user gets 0 mail folders, only INBOX.

the 3-4 folder options above should be effected for admin user too (i mean /home/[dom]/Maildir)

You can make use of a skeleton folder to define additional mailboxes for new users and domains.

Just go to System Settings -> Virtualmin Configuration -> Initial files directory for mail users and set it to something like /etc/mail-skel . Then under that directory, create Maildir/.junk/{cur,tmp,new}

thanks, I know about skeleton but wasnt sure how to use it. i will use your tip for now!

please add the Junk option to the dialog though? we are in teh 21st century. roundcube and thunderbird expects "Junk" to exist and we shouldnt have to create a skeleton folder to make that work ;)

So the "junk" folder is the new "spam" ?

yep this is the built-in Roundcube defaults:

$rcmail_config['drafts_mbox'] = 'Drafts';
$rcmail_config['junk_mbox'] = 'Junk';
$rcmail_config['sent_mbox'] = 'Sent';
$rcmail_config['trash_mbox'] = 'Trash';
$rcmail_config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');

this is thunderbird:

Drafts = Drafts
Junk = Junk
Sent = Sent
Trash = Trash
Templates = Templates
Archives = Archives

apple mail:

Junk = Junk (http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT4911/ht4911_2-mail_os_x-behaviors_junk-en-001-en.png)

so no modern client out of the box understand "spam" and all expect "Junk" to be the name

also they all expect "Sent" not "sent" etc... first letter capital... otherwise they will create "missing" folders, so you end up with "Sent" + "sent" + "Drafts" + "drafts" + "Trash" + "trash".

so to join the 21st century i set all names to Sent, Drafts, Trash in virtualmin options, and I manually created Junk (but will use your skeleton idea next). after i do that, all mail clients love my server and can understand it ;)

ps: no need to pre-create Templates / Archives, because those are not needed by thunderbird and it will create them if a user uses those features.

pps: reason to pre-create "Junk" is so mail clients know server supports it. it helps them to understand and find it without user having to make it.

this remind me... your roundcube install script should also set 1 more option:

$rcmail_config['create_default_folders'] = true;

even tho roundcube config knows the correct Junk, Spam, Drafts and Trash names by default, it will not subscribe to them/show them in the left side list, unless this config is enabled too.

the option name makes roundcube create them if missing (theyre not missing if following my steps for correct names), and then subscribes to them

You can actually Virtualmin to use these folder names, at System Settings -> Virtualmin Configuration -> Actions upon server and user creation, and under Spam filtering options.

yep i set up Drafts, Sent + Trash and i made "spam filtering options" send to Junk

but the request was to have an option to pre-create Junk folder just like we can pre-create drafts, sent and trash

when a user adds his email account to thunderbird, it looks if "Junk" exists and if not it doesnt enable junk folder filing...

so we must pre-create it

i will use youR skeleton idea for now but my hope is that "Actions upon server and user creation" will have an option to pre-create "Junk" too so that skeleton is not needed

by the way, regardless of whether we call the junk folder by its proper name ("Junk") or another name, there's one thing you've missed.

since it's not one of the "big 3" folders (Inbox/Sent/Trash), imap clients will usually not automatically subscrib to it (the same goes for the Drafts folder). this is a problem since we're sometimes putting misclassified legitimate emails in the Junk folder. so what to do?

well, I will give you a hint at the same time as I show you how my mail-skel looks (thanks for the tip by the way):

# mkdir -p /etc/mail-skel/Maildir/.Junk/cur
# mkdir /etc/mail-skel/Maildir/.Junk/new
# mkdir /etc/mail-skel/Maildir/.Junk/tmp
# echo -en 'Drafts\nSent\nJunk\nTrash\n' > /etc/mail-skel/Maildir/subscriptions

(also note that this file is specific to Dovecot, and will not do anything for other IMAP servers)

also gotta warn you about something that is VERY relevant for Virtualmin: any clients that connect over POP3 will only see the INBOX folder, not the spam/Junk folder.

virtualmin, by default, puts all spam in the "spam" folder, and any POP3 clients will simply never, ever see those emails. not in a million years. that's kinda bad since spam classification is sometimes wrong.

my solution: disable POP3 completely. it's such an awful protocol. we live in a world where almost everybody has webmail and multiple devices all wanting to access the same email account. POP3 just connects from 1 device, steals all emails and deletes them from the server, and doesn't even support subfolders.

others that have joined my move include Microsoft and other big players. windows 8 does not support POP3 anymore, and they dropped POP3 from hotmail back in 2006.

the two solutions are to either do what I did (disable pop3, the best thing one can possibly do), or to set up Dovecot to use a VIRTUAL "spam" folder (http://wiki2.dovecot.org/Plugins/Virtual) but actually store all emails in a single folder. the latter is a boatload of work and doesn't work well at all even after all that hassle. so really, just drop pop3 support by default. anyone that enables pop3 should be aware that they must disable "move spam to the spam/Junk folder" and a bunch of other issues sich as the fact that they lose out on the ability to offer webmail and that the customer will only be able to access his email from 1 device.

If you configure Virtualmin to deliver spam to the "Junk" folder, it should get automatically created for new users.

Regarding POP3, I agree that it is an obsolete protocol. However, I'm sure that if we were to disable it in Virtualmin, other user would complain that their ancient mail clients were unable to connect :-(

"If you configure Virtualmin to deliver spam to the "Junk" folder, it should get automatically created for new users."

ooh that explains things, sorry, so you were doing things right after all! now i know why i am not getting the folder. i have actually set all domains to "deliver spam to: deliver normally" so that the per-domain procmailrc files don't do the "x-spam-status==yes?immediately store in Junk folder" check.

it was necessary because i need emails to survive the spam/virus check and return control back to /etc/procmailrc for final passing through dovecot-LDA which in turn runs Sieve filters (possibly deleting spam if filters match) and then filing it in the Junk folder if required.

gotcha. well then you were doing everything right with the Junk folder, and my workaround will be required for anyone that uses dovecot-LDA for delivery (a few of us, i saw forum threads from other virtualmin users, hehe).

the nice parts about dovecot-LDA are that it supports amazingly good user-controllable filters and that it automatically indexes incoming email and sends imap notifications to the client to let it know that there is new mail (push mail rather than pull mail, basically). no more need to "poll every 10 minutes for new emails", instead, emails show up instantly in the users client the second it has been received by the server. it's pretty mindblowing to see, really. that, along with the amazing sieve filters (with perfect roundcube integration for the creation of those) is just too good to pass up. :)

oh yes as for pop3, i did not mean to remove the feature; just to add four hefty warnings: you can access it from 1 device only, no way to provide webmail, emails will not be "backed up" by the server so if a compuer crashes you lose all your emails, and you must disable the "spam" folder and any other subfolders to avoid losing emails (since pop3 only checks the inbox).

and about subscriptions: clients will not see any folders unless the imap server is told that they are subscribed to them. see my trick 1 or 2 posts up for how to create such a dovecot "subscriptions" file, so that clients will see every one of their folders as soon as they connect to their account with their email client. I also mentioned a necessary Roundcube setting to achieve the same thing which should be done by your roundcube auto-install script (otherwise roundcube will not know which special folders to use).

and lastly: thunderbird, apple mail, roundcube are the clients I have looked at so far and they all expect "Drafts/Sent/Junk/Trash" so again, you may want to look into making the new virtualmin defaults Uppercase and Junk. otherwise all modern clients will create their own uppercase variants and users end up with "drafts/Drafts/sent/Sent/spam/Junk/trash/Trash" (twice the amount of folders). i have observed this behavior with my own eyes during testing and promptly switched over to creating the uppercase folders by default.

i can now also confirm that iPhones and iPads expect it to be called "Junk" and will display it with a nice, custom spam icon if that folder is found.

do you know of a single email client that expects the "spam" folder?

I haven't looked into what common mail clients expect .. but I will do some additional research, and update this bug. It should be trivial for me to change the defaults in Virtualmin for new installs.

yeah it would be trivial. as for clients, i've done testing with these so far:

Thunderbird
Roundcube
Apple Mail
iPad
iPhone

every one of them were pre-configured to look for Drafts/Sent/Junk/Trash by default,

i wish i could try Outlook too, but i haven't got any windows machines around here (i don't have that much of a death wish!). ;)

if/when you do update the defaults to the capitalized names + Junk folder, remember my final trick which is to pre-create the Dovecot IMAP subscriptions file:

    echo -en 'Drafts\nSent\nJunk\nTrash\n' > ~/Maildir/subscriptions

if that file is missing, what happens is that the email clients will connect, but the Dovecot server will say "this server contains 4 folders, but the user is not subscribed to any of them", so the mail client dutifully shrugs and says "okay, if you say so!" - and won't show users any of their folders apart from Inbox and Trash. this is most serious for the Junk folder, since it's one that admins definitely want their users to be instantly aware of. the other folders aren't as serious, since their client will automatically subscribe to them once the user begins sending emails and saving drafts etc.

well, by pre-subscribing the user to all important folders, we avoid all of those issues, and make it so that clients will immediately see all available folders upon first connection, giving end-users a better experience. :)

Are you sure that creating that subscriptions file is necessary? On the IMAP clients I've used, all folders show up by default.

yes, 100% sure.

clients may choose to subscribe to a few special folders on setup/usage but it's entirely up to the discretion of the client implementation. many don't. thunderbird doesn't. roundcube doesn't.

the reason is simple: the client cannot know if it is the first client ever to connect to that mail server or whether the user may already have a subscription state that they want to preserve, so all it knows is that "okay this server has 4 folders and the imap server is telling us that the user is not subscribed to any of them". for this reason, the correct thing(tm) for the client to do is to not list any folders.

the exception is Inbox, which is always subscribed to no matter what, as well as Sent/Drafts/Trash which will be subscribed to as soon as the user tries sending an email, saving a draft or deleting an email.

but most clients will not subscribe to any other folders.

so, by auto-creating the subscriptions file on user creation, we have made an unambiguous and user-friendly environment where any client will see "aha, there are 4 folders, and we are subscribed to all four, so let's show them all to the user!"

there are many clients that will never auto-subscribe to anything but the core folders (Inbox/Drafts/Trash/Sent), and the ones that do usually show zero folders until the user tries performing certain actions that require those folders, upon which they pop into view (thunderbird, roundcube). that is neither nice nor intuitive, and the subscriptions file is therefore our way of helping ensure that users see every folder from day one, with zero issues, and no risk that a folder stays permanently unsubscribed and unknown to the user.

also note: the subscriptions file is updated automatically by Dovecot as the client modifies their subscriptions. all we're doing by autocreating it is making a perfect initial state for the user.

also also note: you must end with a newline after the last folder name or Dovecot will ignore the last subscription line. wrong: 'Drafts\nSent\nJunk\nTrash', correct: 'Drafts\nSent\nJunk\nTrash\n'

Ok .. It seems pretty safe to create the subscriptions file regardless of whether clients really need it or not. I'll do that in the next release.

it is indeed completely safe. it'll be created (blank) on their first IMAP login if we don't do it for them.

Ok, I have implemented the change of the default folder names to Sent, Junk, Trash and Drafts as suggested.

Also, new users will get a subscriptions file automatically.

Automatically closed -- issue fixed for 2 weeks with no activity.