You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
4.6 KiB

<h3>Configuration Changes Needed When Using Maildir</h3>
<p>If you forward your mail from the SDF cluster using a forward as
described in the <a href="">MetaArray</a>
tutorial, you may have to update your mail client's configuration, as mbox
format is used there. If you use procmail, for example, .procmailrc
configuration will be slightly different. Lockfiles are not needed in
recipes (the trailing ':' after the zero), and directories are used as
destinations for mail. Some of the environment variables are different, as
<p>The above will send all mail by default to the directory
'~/Maildir/.inbox' (just replace USERNAME with your own user name and LETTER
with the first letter of your user name).
<p>Here is a .forward that works with procmail on the MetaArray:</p>
"|exec /usr/pkg/bin/procmail -f-||exit 75 #USERNAME"
<p>Again, replace USERNAME as appropriate.</p>
<p>If you use mutt, your .muttrc will need to be updated. Here is
a minimal maildir config you can incorporate into an
existing .muttrc. Note the two 'set spoolfile' lines -
the commented one will tell mutt to pull from your system mail spool,
however the next, uncommented one that references the '.inbox/'
directory will work with the .procmailrc snippet,
above. The '.Sent' and '.Drafts' folders are just standard
folder names that are compatible with most IMAP implementations, but if you
don't use IMAP they can be named anything.
#set spoolfile="/meta/mail/USERNAME"
set spoolfile="~/Maildir/.inbox/"
set folder="~/Maildir/"
set mbox_type = Maildir
set mask="!^\\.[^.]"
set record="+.Sent"
set postponed="+.Drafts"
mailboxes `echo -n "+ "; find ~/Maildir -maxdepth 1 -type d -name ".*" -printf "+'%f' "`
macro index c "&lt;change-folder&gt;?&lt;toggle-mailboxes&gt;" "open a different folder"
macro pager c "&lt;change-folder&gt;?&lt;toggle-mailboxes&gt;" "open a different folder"
macro index C "&lt;copy-message&gt;?&lt;toggle-mailboxes&gt;" "copy a message to a mailbox"
macro index M "&lt;save-message&gt;?&lt;toggle-mailboxes&gt;" "move a message to a mailbox"
<p>The changes to the mailboxes command and c/C/M macros allow mutt to work
with maildir folders, even if the folder names change at some point.</p>
<h3>Converting Mbox to Maildir</h3>
<p>If you want to convert your existing mbox-style mailboxes to maildir
format, you can use 'mbox2maildir' to do so. The syntax for using it is as
mbox2maildir [mbox file] [maildir directory]
<p>The maildir directory will be created if it does not exist. As an
example, let's say I have copied the mbox file for the gopher mailing list
from iceland to ma, and copied it to ~/mail/gopher (where it is on
iceland). I would then run the following:</p>
mbox2maildir ~/mail/gopher ~/Maildir/.lists.gopher
<p>Once run (no errors should be displayed), you can verify the contents of
the new maildir directory:</p>
slugmax@ma:~> ls -la ~/Maildir/.lists.gopher/
total 40
drwx------ 5 slugmax arpa 4096 May 14 14:16 .
drwx------ 5 slugmax arpa 4096 May 14 14:16 ..
drwx------ 2 slugmax arpa 24576 May 14 14:16 cur
drwx------ 2 slugmax arpa 4096 May 14 14:16 new
drwx------ 2 slugmax arpa 4096 May 14 14:16 tmp
slugmax@ma:~> ls -la ~/Maildir/.lists.gopher/cur/
total 3472
drwx------ 2 slugmax arpa 24576 May 14 14:16 .
drwx------ 5 slugmax arpa 4096 May 14 14:16 ..
-rw------- 1 slugmax arpa 3452 May 14 14:16 1337019395.6264.mbox:2,S
-rw------- 1 slugmax arpa 5131 May 14 14:16 1337019396.6264.mbox:2,S
-rw------- 1 slugmax arpa 4094 May 14 14:16 1337019397.6264.mbox:2,S
<p>You can see that mbox2maildir has converted each message in the mbox file
to its own file and placed each in the maildir-standard 'cur'
<h3>Converting Maildir to Mbox</h3>
<p>As you might guess, converting maildir-format folders to mbox is done by
the 'maildir2mbox' utility. It operates using environment variables, not
command line options, so to be clear it might be best to specify them with
the command:</p>
MAILDIR=~/Maildir/.lists.gopher/ MAIL=~/mail/gopher MAILTMP=~/tmp/foo maildir2mbox
<p>Note that the file specified by MAILTMP and the one specified by MAIL
must be on the same filesystem. When this command is run, you should see the
~/mail/gopher mbox file in place:</p>
slugmax@ma:~> ls -l ~/mail/gopher
-rw------- 1 slugmax arpa 2680127 May 14 14:34 /meta/s/slugmax/mail/gopher
<cite>$Id: maildir.html,v 1.5 2019/07/23 01:30:22 slugmax Exp $</cite>