Re: mbox2maildir (was Re: Dazed Confused)

1999-11-29 Thread Subba Rao

On  0, Bennett Todd [EMAIL PROTECTED] wrote:
 1999-11-27-02:57:18 Nathan Cullen:
  Okay, I'm sold. :)   But first, is there a simple way to convert my
  current mbox folders(files) into maildir format?  Is this handled by
  mutt or another utility?
 
 It can be done in mutt; once you've set mbox_type="Maildir" you can visit an
 mbox, tag everything (T~A) and then save all tagged messages to another folder
 (;sfoldername) and if foldername doesn't already exist, mutt will create it in
 its new default format, Maildir.
 


Where do you set mbox_type="Maildir"? In .muttrc?
Are the double quotes required? What is the difference between mbox_type and
$mbox_type in .muttrc?

Subba Rao
[EMAIL PROTECTED]
http://pws.prserv.net/truemax/



Re: mbox2maildir (was Re: Dazed Confused)

1999-11-29 Thread Bennett Todd

1999-11-29-08:14:41 Subba Rao:
 Where do you set mbox_type="Maildir"? In .muttrc?

As with all such commands, you can put it in your .muttrc and restart mutt;
you can put it in your .muttrc and type

:source .muttrc

or you can just preceed it with a colon, and directly type

:set mbox_type="Maildir"

 Are the double quotes required?

I'm not sure. I just typed it the way it appeared in my .muttrc. For whatever
it's worth, the example in /etc/Muttrc seems to have the arg in double-quotes.

 What is the difference between mbox_type and $mbox_type in .muttrc?

$mbox_type I don't know about. Where do you use it?

-Bennett

 PGP signature


Re: mbox2maildir (was Re: Dazed Confused)

1999-11-28 Thread Thomas Roessler

On 1999-11-27 20:13:14 -0500, Bennett Todd wrote:

 If you have a pile of them, then an external mbox2maildir script
 may be appreciated. They are so simple everybody ends up writing
 their own; the one I use is attached. It does simple mbox format,
 i.e. trusting ^From when it sees it and not attempting to honor
 Content-Length.

I'd probably use mutt in batch mode for such tings.

-- 
http://www.guug.de/~roessler/




Re: Dazed Confused

1999-11-27 Thread Mikko Hänninen

Ken Gunderson [EMAIL PROTECTED] wrote on Thu, 25 Nov 1999:
 Okay, I admit it; I am brain deaded.  I've read through the docs and sample
 muttrc's but am still confused about how to set up mutt to handle mailing
 lists.  Yes defining the lists themselves is piece of cake, but how to best
 deal with sorting mail.  For example, assume incoming mail for list1,
 list2, and list3 get delivered to /var/spool/mail.  How to be setting up
 folder-hooks, mhooks, etc.?

Mutt doesn't do mail sorting, at least not mail filtering to different
folders on delivery, which is what you're talking of.  You need to use
a different tool for that.  The most commonly used filtering program
is procmail (which just came out with a new version that has Maildir
support natively, finally!).  An alternative is the newer maildrop
toolset.

 mbox vs maildir, what's the pro/cons of each?  

The primary advantage of Maildirs is that there is no need for folder
locking, therefore you can have (in theory) an arbitrary number of
applications accessing a Maildir mail folder.  This is especially useful
if your mail folders are read over NFS, where file locking is typically
either nonexistent or unreliable, if implemented.  I consider Maildir
the only option, in practice, for incoming mail folders which are
accessed over NFS (just IMHO).


Maildirs store each email message as a separate file, which is the
primary reason for all of the pros and cons as compared to mbox.  All
of the speed issues listed below are only noticeable with large folders,
for small ones it doesn't really matter.

Maildirs compared against mbox:
- slightly slower to read in
- faster operations when operating on single messages -- no need to
write out the entire folder like with mbox when deleting a message from
the top, for example
- more reliable checking of whether the folder has new mail or not
(no need to play with file timestamps)
- no need for locking (see discussion above)
- much simpler to create custom tools for handling the mail that work
on individual messages, on the other hand it's slightly more complex to
create "mail filters" which operate on an entire folder


Hope this helps,
Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy  scifi, the Corrs /
Driver's mantra: To slow is to falter, to brake is to fail, to stop is defeat.



Re: Dazed Confused

1999-11-27 Thread Nathan Cullen

 The primary advantage of Maildirs is that there is no need for folder
 locking, therefore you can have (in theory) an arbitrary number of
 Maildirs store each email message as a separate file, which is the
 - faster operations when operating on single messages -- no need to
 write out the entire folder like with mbox when deleting a message from
 the top, for example
 - more reliable checking of whether the folder has new mail or not
 (no need to play with file timestamps)
 - no need for locking (see discussion above)
 - much simpler to create custom tools for handling the mail that work
 on individual messages, on the other hand it's slightly more complex to
 create "mail filters" which operate on an entire folder

Okay, I'm sold. :)   But first, is there a simple way to convert my
current mbox folders(files) into maildir format?  Is this handled by
mutt or another utility?

-- 
==
 Nathan Cullen [EMAIL PROTECTED]
==



mbox2maildir (was Re: Dazed Confused)

1999-11-27 Thread Bennett Todd

1999-11-27-02:57:18 Nathan Cullen:
 Okay, I'm sold. :)   But first, is there a simple way to convert my
 current mbox folders(files) into maildir format?  Is this handled by
 mutt or another utility?

It can be done in mutt; once you've set mbox_type="Maildir" you can visit an
mbox, tag everything (T~A) and then save all tagged messages to another folder
(;sfoldername) and if foldername doesn't already exist, mutt will create it in
its new default format, Maildir.

That's certainly the easiest approach for a single mbox.

If you have a pile of them, then an external mbox2maildir script may be
appreciated. They are so simple everybody ends up writing their own; the one I
use is attached. It does simple mbox format, i.e. trusting ^From when it sees
it and not attempting to honor Content-Length.

-Bennett


#!/usr/bin/perl -w
use strict;
use File::Basename;
use Sys::Hostname;
use IO::File;

$0 = basename $0;
my($syntax) = "syntax: $0 mbox maildir\n";
die $syntax if $#ARGV != 1;
my($mbox, $maildir) = @ARGV;

die "$0: $mbox is not a file\n" unless -f $mbox;
die "$0: can't read $mbox\n" unless -r $mbox;
die "$0: can't open $mbox\n" unless my($fi) = IO::File-new("$mbox");

-d $maildir or mkdir $maildir,0777 or die "$0: can't create $maildir: $!\n";
die "$0: cannot chdir $maildir\n" unless chdir $maildir;

for (qw(tmp new cur)) {
-d $_ or mkdir $_,0700 or die "$0: can't create $maildir/$_: $!\n";
}

my($time) = time;
my($pid) = 10;
my($hostname) = hostname;
my($msg,$fo);
line: while ($_ = $fi-getline) {
if (/^From /) {
if (defined $msg and defined $fo) {
$fo-close or die;
if (-s  "tmp/$msg") {
rename "tmp/$msg", "new/$msg" or die;
} else {
unlink "tmp/$msg" or die;
}
}
$msg = join '.', $time, $pid++, $hostname;
die if -f "tmp/$msg";
$fo = IO::File-new("tmp/$msg") or
die "$0: can't open $maildir/tmp/$msg: $!\n";
next line;
}
$fo-print($_);
}
if (defined $msg and defined $fo) {
$fo-close or die;
if (-s  "tmp/$msg") {
rename "tmp/$msg", "new/$msg" or die;
} else {
unlink "tmp/$msg" or die;
}
}

 PGP signature