Creation of mail folders

17 posts / 0 new
Last post
#1 Thu, 08/03/2006 - 00:05
jpenix

Creation of mail folders

I'd like all new mail users to automatically have a Trash and Sent folder set up in their Maildir so that IMAP clients like Thunderbird will automatically use them. I didn't see an obvious way to do this in Virtualmin... suggestions?

Also I notice that even though my system is set up to use Maildir, every mail user also winds up with an empty "mail" directory in their home. Is this a bug I should report? Or have I just overlooked a setting somewhere?

Wed, 08/09/2006 - 21:13
jpenix

Just a bump hoping for some ideas.

Thu, 08/10/2006 - 15:29
ADobkin

I think there are several ways to have these files automatically created with the user account. One way might be to put them in /etc/skel. Another way might be to use the "Before and after commands" in the Webmin Users and Groups module configuration to specify that these files be created. I remember Jamie posting some sample code to the Webmin list about this a while back, but I don't have it handy right now.

Regarding your second paragraph, I have this same question/problem also. I reported it several months ago and got the response that Maildir is used for the inbox, while mail is used for other saved mailboxes. This didn't quite make sense to me at the time, but I forgot to pursue it until you brought it up again. Actually, I think having both of these folders has caused confusion in the Usermin Read User Mail module, because none of the user mailboxes in the Maildir directory show up there. I'm sure there is a way to reconfigure it and fix this, but my system (and probably yours too) was set up with the defaults, so I thought it should work properly out of the box. So, in this light, I would say yes, it probably should be considered a bug, at least in the installer.

Aha, I just found the bug I reported,[A HRef="http://www.Virtualmin.com/bug-tracker/bug?bug_number=65">Bug #65</A>.

Thu, 08/10/2006 - 18:13
jpenix

Thanks Alan. I tried setting up my Maildir structure in /etc/skel, but apparently Virtualmin doesn't use that to set up new mail/ftp user home directories (I don't get a .bashrc either). I'll look at doing something in a script and triggering it on user creation, but it seems like this is something that should be done by Virtualmin. It autocreates the $HOME/mail directory that you refer to in your bugreport, so I'm hoping it can be told to create additional user-specified directories or files.

On the subject of your bugreport, I'm also dissatisfied with the way the Usermin mail module deals with Maildirs. I see they fixed it so that now you can at least see the messages in the Inbox, but it still remains configured to put drafts and sent items into $HOME/mail instead of the common $HOME/Maildir/.Sent and .Drafts. This would be very annoying to a user who sometimes uses an IMAP client like Thunderbird but also uses the webmail - they'd wind up with sent items in two different locations.

An additional flaw in the Usermin mail module is that it exposes mail server working files like maildircache and subscriptions to the user. Very confusing and I don't know what the purpose is.

Thu, 08/10/2006 - 23:54
Joe
Joe's picture

Hey guys,

I agree that some of this stuff is a bit confusing. I've asked Jamie to drop in and give us the scoop on getting Usermin to behave a bit more sociably. I suspect our installer is probably missing a step or two in configuring Usermin to play well with Maildir.

--

Check out the forum guidelines!

Fri, 08/11/2006 - 00:43
Joe
Joe's picture

If you want to get Usermin and IMAP to work nicely together, the best solution is to configure it to use ~/Maildir as both the inbox and the location of sub-folders. This can be done as follows :

1) Login to Webmin as the master administrator, and go to the Usermin Configuration module.
2) Click on the Usermin Module Configuration icon.
3) Click on Read Mail.
4) Change the 'Mailboxes directory under home directory' field to Maildir, and click Save.

--

Check out the forum guidelines!

Fri, 08/11/2006 - 01:04
Joe
Joe's picture

Hey Jamie,

Any reason we're not setting this up by default, during installation?

--

Check out the forum guidelines!

Sat, 08/19/2006 - 11:08
ADobkin

I followed Jamie's instructions, but still was only able to access the user's Inbox from the Read User Mail module. Eventually, I discovered that there are separate module config options for the[Em>Webmin</Em> Read User Mail module (vs. the one in Usermin). I had to set this module to use "Maildir" in at least these three fields (and I'm not sure exactly how they differ):

User mail file directory: Maildir
Mail directory in user home directories: Maildir
Usermin-style folders subdirectory in home directory: Maildir

In addition, there is another option "Mail file in user home directories", currently set to "Mailbox". I have no idea what this option is for and what it should be set to.

These various options in multiple places are quite confusing, to say the least, and the defaults are definitely not set right for Virtualmin Professional users.

Sat, 08/19/2006 - 11:32 (Reply to #8)
Joe
Joe's picture

Hehehe! That's frightening. Sometimes I feel like biting Webmin because it has too many options. The problem is that everyone wants to be able to tweak just one knob...but everyone wants a different one to tweak, so we end up with thousands of options and everybody only ever uses one or two of them. It's featuritis, and it's darned hard to fight. Everyone seems so reasonable when they say, "I need to be able to change X because I've got Y running over here and it wants Z to look like this." And if we argue, "no, we're not adding any more options", we're tyrants an unresponsive to users. Ah, the joys of Open Source...everybody does it their own way, and we have to help them. ;-)

The good news is that in Virtualmin Professional we do have the ability to get it right by default. So, that's what we're going to do. I believe the next virtualmin-base package that I'm rolling out in the next day or two has this setup correctly (but I'm going to test it and keep poking at it until it is right, if it isn't). This is definitely one of the things keeping folks from adopting Usermin for webmail--I've had folks explaining that it was because Usermin doesn't support IMAP (it does), Maildir (it does), multiple folders (it does), shared sent/trash/etc. with IMAP (it does). But since it's so darned hard to get it configured right, folks can't possibly be blamed for thinking it doesn't!

Anyway, thanks for hashing this one out guys.

--

Check out the forum guidelines!

Sat, 08/19/2006 - 14:10 (Reply to #9)
ADobkin

I definitely understand the creeping featuritis and can sympathize. But there is a cure! Several things can be done to improve the situation, as you alluded to, and I'm very glad that you are taking that path.

The best and most important cure of all is to first set the defaults properly for the majority of users. That way, they hopefully won't even need to go in and mess with these settings at all. Fortunately, this should be very easy to achieve in Virtualmin Professional, since we are starting with a known supported environment (i.e. Postfix, Dovecot, Maildir, etc.).

If users do mess with the settings, either because they have a slightly different-than-average need or just like to tweak things, then the next best cure is to organize the configuration layout so that only the basic and most frequently-changed options appear at first. Then, they can change settings without having to worry about totally screwing things up accidentally. For those advanced users that really need to change the more obscure settings, there should be an "advanced" or "expert" area, with the caveat that those settings should only be changed "if you really know what you're doing!"

The final cure (sad that this is a last resort) is that these options need to be documented. None of the configurable options in the Webmin or Usermin Read Mail modules have clickable help text. So, it is anyone's guess what some of these obscure options really do.

I have to agree that this is one of the main reasons why people don't use Usermin for webmail. I have implemented several different webmail clients over the past ten years or so, and Usermin has certainly been the hardest one to set up properly, at least when Maildir is involved. This doesn't need to be the case, since it is so flexible as you've pointed out. So, we need to get these featuritis cures (appropriate defaults, better layout of config options, and help text) implemented to make Usermin a more feasible option. (And, ironically, we also need to[Em>add</Em> a few new features to make it more competitive with some of the more mature, well-polished popular clients.)

One other suggestion that has been made already is that Usermin should just rely on the IMAP server to provide its mail, as virtually every other webmail client does. This would completely eliminate a lot of these confusing options, since they are already properly set and handled by the IMAP server. In other words, Usermin shouldn't need to know and the user shouldn't care whether the mail store is using mbox, Maildir, or something completely different. (That's why most other mail clients don't suffer from this complexity.) All it needs to know is what IMAP server is being used, and the mail folders list is pretty much automatic at that point. So, this begs the question: [Em>Why not just set up Usermin for IMAP by default?</Em>

Sat, 08/19/2006 - 18:58 (Reply to #10)
Joe
Joe's picture

<i>So, this begs the question: Why not just set up Usermin for IMAP by default?</i>
&lt;p&gt;
Good idea (for me or for you), but there's three reasons why not:
[ol]

[*]The majority of providers still prefer their users to use POP3. Either because the user is familiar with it, or because they don't want to keep MB or GB of the users mail on their servers. This is the most important problem with IMAP as a default.[/*]

[*]Usermin doesn't currently know the users password, without being told. This could be changed, of course, but I don't know that we need to--given that Usermin supports local Maildir access. If the first were a non-issue, then this could be addressed.[/*]

[*]IMAP is foreign to a lot of users, and POP3 isn't feasible for the default in this case. This is subtly different from #1. Even if all of our customers come around to offering IMAP universally to all of their customers, we still have the problem of getting users to setup their mail clients to use IMAP. This is harder than it seems. I've had to do it at a couple of offices and there's just something broken about users and computers--they do the exact same thing they've always done even when told to do something else. I've handed out instructions sheets explaining how to setup IMAP mail access and for weeks afterward I would receive phone calls from people asking why mail wasn't working (POP3 was disabled--the company needed everything stored on the server for mail retention and backup policies).[/*]

[/ol]

&lt;p&gt;
We're gonna try to get the defaults right for local access, and see if that wraps this up for good. If not, we'll see about coming up with another solution.

--

Check out the forum guidelines!

Sun, 08/20/2006 - 01:15 (Reply to #11)
ADobkin

Joe, I believe that #1 and #3 are completely non-issues.

Regarding #1, there is nothing stopping Usermin from running directly against an IMAP server, while the same users also use POP mail clients when their at home or in their office. In other words, IMAP and POP and interoperate just fine against the same mail store at different times. Again, this is exactly the way virtually all other webmail clients work, including SquirrelMail and Horde/IMP, and nobody has a problem using them via a web browser, and then accessing their mailbox via POP at another time. Millions of users do this all the time. This is also how many Blackberry users get their mail, so it is definitely a well-supported method of operation.

Fundamentally, POP was designed for offline access (i.e. primarily desktop-based interaction), and IMAP was designed for direct online access (i.e. primarily server-based interaction). By definition, webmail clients run on the server, which makes them a perfect match for an IMAP server. I don't think there are any webmail clients using POP, as this just wouldn't make much sense. One additional benefit of IMAP is that the webmail server doesn't have to be the[Em&gt;same&lt;/Em&gt; server as the mail store. This isn't available with direct file access, unless doing some type of network filesystem, such as NFS, which is almost always a bad idea with e-mail.

As to #3, I think I understand your point here, but this is not an end-user issue at all. Again, IMAP can be used with Usermin (on the server), while end users can still access their mail using a POP client on their desktop. There is nothing forcing users to switch to IMAP on their desktop just because Usermin is running against an IMAP server.

If the issue is that providers don't want to even offer IMAP access to the desktop clients, then this is easily solved too. Simply set the IMAP server and/or the firewall to only accept IMAP connections from localhost. Then, Usermin can connect all day long, but desktop clients will be blocked.

So, the only real problem here is #2, but as you suggested, this can be addressed. 99% of the time (especially given the known supported default setup of Virtualmin Professional, which is all we should be concerned about for now), the IMAP server userid and password is going to be exactly the same as the Usermin login. It seems like it should be trivial for Usermin to store this information in a session cookie (I thought it already did this anyway) and then pass it to the IMAP server. If that fails in a few cases, then the IMAP server can prompt for the user to enter their password. Problem solved. Q.E.D. :-)

Sun, 08/20/2006 - 00:55
Joe
Joe's picture

Usermin does have support for IMAP, but at the moment it has two limitations :

1) The first time you use it, you need to re-enter your password for the IMAP server.
2) Other folders are not yet fetched from the IMAP server.

After reading some of the comments here, I will move improved IMAP support up my priority list, and make it the default in Virtualmin once it is ready. That should avoid the need to mess with all the configuration options related to finding users' Maildir / mbox files.

--

Check out the forum guidelines!

Sun, 08/20/2006 - 01:19 (Reply to #13)
ADobkin

Interesting, I didn't realize these limitations, especially #2. That is definitely a show-stopper for using IMAP with Usermin for now, so I see why direct mbox and Maildir access has been preferred so far. However, if you can overcome these limitations, I think it will make Usermin a much stronger option for and make it a lot easier to set up properly.

Sun, 08/20/2006 - 03:29
jpenix

I know the conversation has generalized from my original question, but following the &quot;sea of configuration options&quot; theme I am reporting back to tell you how I solved the automatic creation of Trash and Sent.

In Virtualmin's module configuration, there is an option called &quot;Initial files directory for mail users&quot; which by default is set to None. I created my desired Maildir layout in /usr/local/etc/mailskel and then put that path as the value for that configuration option. Now when I create new mail users in a virtual host, they get the folder tree prepared for them right at the start. For good measure I also added the same folders to /etc/skel so that domain owners get set up too.

Sun, 08/20/2006 - 07:53 (Reply to #15)
ADobkin

Sorry for hijacking your thread. :-) But I think it was for a good purpose. Thanks also for reporting back with the solution to your original post! I will do the same thing on my systems. This seems like it would be a good recommendation for defaults on new Virtualmin Pro installations.... Joe?

Sun, 12/29/2013 - 14:36
ReArmedHalo

I know this is an old thread but it comes up first when I did a Google search. Figure I'd share information in case others find this in the future:

  • Virtualmin Configuration
  • Select Action upon server creation...

You can specify the folders names for trash, sent and drafts there. Spam folder is under Spam filtering options in Virtualmin Configuration as well.

This method might be easier for some as opposed to creating structure on filesystem and using "Initial files directory for mail users".

Also a helpful bit: (iOS devices detect certain folders but only with specific folder names) (Case sensitive names, not sure if it matters but I think it looks nice, make sure you remove the "quotes" around the folder name)

Default Delivery for spam: Junk Maildir folder
Drafts folder name for new mailboxes: Drafts
Trash folder name for new mailboxes: Other name > "Deleted Messages"
Sent mail folder name for new mailboxes: Other name > "Sent Messages"

If you have roundcube webmail, add/edit these in your main.inc.php file (Around line 450, most of these lines exist already)

$rcmail_config['drafts_mbox'] = 'Drafts';
$rcmail_config['junk_mbox'] = 'Junk';
$rcmail_config['sent_mbox'] = 'Sent Messages';
$rcmail_config['trash_mbox'] = 'Deleted Messages';
$rcmail_config['archive_mbox'] = 'Archive'; //I have the Archive plugin enabled
$rcmail_config['default_folders'] = array('INBOX', 'Drafts', 'Sent Messages', 'Junk', 'Virus', 'Deleted Messages', 'Archive');
$rcmail_config['create_default_folders'] = true;
$rcmail_config['protect_default_folders'] = true;

Now Roundcube and iOS will recognize the sent, trash, archive, drafts, junk folders as they are without needing to configure any of them in Roundcube folder options or iOS Mail, Contacts and Calendars.

NOTE: I don't know how to have Virtualmin create the Archive folder so that's why I have Roundcube do it. So best practice would be have the user login to Roundcube before setting up on iOS otherwise you'll probably have to set the archive folder to be the folder once it's created with Roundcube.

Only thing that needs to be done on the iOS device is going to:

  • Settings > Mail, Contacts and Calenders > Select mail account
  • Select "Account email@domain.tld" > Scroll down to "Advanced"

On this screen all the folders should correctly match to their appropriate label. Archive can be left blank if your not doing archival

  • "MOVE DISCARDED MESSAGES INTO" > Select if you like archive or to delete messages.

Hope this is helpful. :)

Topic locked