Subject: Mailbox format how-to

From: Chris Ross <[email-masked]>
Date: Mon, 08 Nov 2004 15:16:26 -0500

Hello there.  I am investigating converting my mail server to using
MBX format (vs. mbox) for everything.  Using tmail for delivery (via
sendmail 8.12), and uw-imap 2004 for access to INBOX and personal folders.

   So, my question is this.  Is there some sort of how-to for building
a system?  I know I need to:

   - modify sendmail.cf (and friends: submit.cf?) to call tmail instead
of mail.local.  The tmail man page has a little info on this.
   - Modify by calls in my procmailrc to use dmail instead of just
specifying the mailbox name (i thing.  this right?)

   So, is there any way to tell tmail to deliver to an mbx format
"main mail spool" if the file doesn't already exist?  I know if
it exists, it'll deliver in the correct format, but what if it
vanishes?

   How hard is it to modify procmailrc's to use dmail?

   A single source of information would be nice, if there was one.
Right now there seem to be a small number of sources of info
for different parts of it, so I thought I'd ask.

   Thanks!

                           - Chris

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Mon, 8 Nov 2004 13:21:06 -0800 (Pacific Standard Time)

> specifying the mailbox name (i thing.  this right?)

So far, so good.

> it exists, it'll deliver in the correct format, but what if it

The easiest way to do this is to edit file
 	imap-200?/src/osdep/unix/Makefile
to set
 	CREATEPROTO=mbxproto
instead of the current unixproto.  Then rebuild the entire UW IMAP 
toolkit.

However, once created, an mbx-format mailbox shouldn't vanish.  So, it 
should work just to create empty mbx-format mailboxes for everybody who 
doesn't have it.  It works to create one, and then copy it to each user 
(there isn't any user-specific in an empty mbx-format mailbox).  That way, 
you don't have to do any rebuilding.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

---

From: Chris Ross <[email-masked]>
Date: Mon, 08 Nov 2004 17:49:55 -0500

Mark Crispin wrote:
> instead of the current unixproto.  Then rebuild the entire UW IMAP toolkit.

   Yeah, I knew about that method.  I was just wondering if there
was a way to make dmail (from procmailrc, for example) know to
instantiate new mail folders as mbx instead of mbox.  It seems not
unreasonable to have command-line args for tmail/dmail (other than
-I) that could specify format.  But, what to do in the case that
it doesn't match existing format might be an issue.

> (there isn't any user-specific in an empty mbx-format mailbox).  That 
> way, you don't have to do any rebuilding.

   Okay.  How would you recommend creating this empty mbx mailbox?
It would be a bit of a pain to make sure to create a spool mbx file
for any new user I want to receive mail from, but not the worst
problem.  Most other folder creations will be done through IMAPd,
tho, so may still require the above.  So...

                              - Chris

---

From: Tim Mooney <[email-masked]>
Date: Mon, 8 Nov 2004 16:57:42 -0600 (CST)

> it doesn't match existing format might be an issue.

Are you planning on doing home directory mail delivery, or delivery to
a spool directory for INBOX and other folders live under ~ or ~/mail?

>  Okay.  How would you recommend creating this empty mbx mailbox?

mailutil create '#driver.mbx/foo' creates folder `foo' in MBX format.

Tim
-- 
Tim Mooney                              [email-masked]
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

---

From: Erik Kangas <[email-masked]>
Date: Mon, 08 Nov 2004 18:02:26 -0500

> it doesn't match existing format might be an issue.

You could do this with a little shell script, something like 
"dmail-create.sh" we use:

#!/bin/bash
if [ ! -e "$HOME/$1" ] && [ $1 != ".inbox" ]; then
    /usr/local/bin/mbxcreat "#driver.mbx:$1"
fi
/usr/local/bin/dmail "+$1"

Where this script takes 1 command line argument - the path of the folder in 
which you want to save the message, relative to the user's home directory. 
".inbox" is supposed to be in unix format so sendmail can deliver to it 
directly "if all else fails", hence the exception.

Then, in your .procmailrc scripts, instead of delivering to dmail, you 
deliver to dmail-create.sh.  I.e.

LOCK=.lock.user.id
:0 :${LOCK}
| /usr/local/bin/dmail-create.sh INBOX

This way, the folder will be created in MBX format if it doesn't exist before 
dmail tries to save the message.

We didn't find any easier way to accomplish this for arbitrary folders; it 
would be nice if dmail could do this itself.

-Erik Kangas

-- 

Erik Kangas, Ph.D. --- President of Lux Scientiae, Incorporated
[email-masked]  --- http://luxsci.com

Office Phone:        1-617-507-2162
Cell Phone:          1-617-596-9558        P.O. Box 326
Luxsci Toll Free:    1-800-441-6612        Westwood, Massachusetts
LuxSci FAX:          1-413-332-0598        02090, USA

---

From: Mark Crispin <[email-masked]>
Date: Mon, 8 Nov 2004 15:15:35 -0800 (Pacific Standard Time)

> /usr/local/bin/dmail "+$1"

I recommend using "mailutil create" instead of "mbxcreat" since the latter 
program is no longer supported.

> would be nice if dmail could do this itself.

I'm not sure that I understand.  dmail never creates a non-INBOX mailbox; 
if the destination mailbox does not exist then dmail will deliver to 
INBOX.

Do you mean "convert mailbox format"?  If so, mailutil can be used to 
convert, albeit to a different name.

-- Mark --

---

From: Mark Crispin <[email-masked]>
Date: Mon, 8 Nov 2004 15:22:42 -0800 (Pacific Standard Time)

On Mon, 8 Nov 2004, Chris Ross wrote:
> instantiate new mail folders as mbx instead of mbox.

dmail is built as part of the IMAP toolkit, so its behavior will be 
affected by the change to CREATEPROTO.

> It seems not

It's messier than that; there are some security issues as well.  The -I 
flag in tmail could be abused for some truly nasty purposes if it was 
allowed for non-privileged calls.

>  Okay.  How would you recommend creating this empty mbx mailbox?

"mailutil create #driver.mbx/foo" will create an empty file named foo 
which you can then copy to "INBOX" in the home directory of all the users 
you want to convert to mbx.

By the way, you do know that you can't use mbx format with NFS, don't you?

-- Mark --

---

From: Chris Ross <[email-masked]>
Date: Mon, 08 Nov 2004 21:31:38 -0500

> affected by the change to CREATEPROTO.

   Right.  I knew that.  I was just looking for a way to do it without
compiling it in as the "default" format.  Tho, I'm not sure there's
a problem with doing that.

> allowed for non-privileged calls.

   Right.  But if there were a "format" command-line arg that doesn't
also specify the filename, that issue goes away.  That was my point
for having a format arg that wasn't -I.

> which you can then copy to "INBOX" in the home directory of all the 
> users you want to convert to mbx.

   Cool.  Thanks...  I need to look at mailutil s'more.  I've looked
at mbx* tools, but they're confusing.  Maybe I shouldn't be looking
at those.  :-)

> By the way, you do know that you can't use mbx format with NFS, don't you?

   Yup.  I'm all on local filesystems here.

                                 - Chris