russischer Abakus Informatik-Vollmer
    

mh2maildir

I've written a small shell script transforming mails stored using the MH format to the MAILDIR, kmail and courier-imap format.

Informations about the maildir format may be found on the pages from D. J. Bernstein

Download

Download the actual version (1.13 of 2006/05/03) of the script.

License

All my tools are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The programs are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

You should have received a copy of the GNU General Public License along with those programs; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

If you find this software useful, please send me a postcard from the place where you are living:
Dr. Jürgen Vollmer
Viktoriastraße 15
D-76133 Karlsruhe, Germany

Usage


usage: mh2maildir [options] old new [folder]
transform mails stored in MH format into MAILDIR format using procmail(1)

Options:
        -a       Abort, if procmail produces differences in the MH and MAILDIR
                 mail. Default: ask the user.
                 (Some minor diff's, like removing a second From: line)
                  are already ignored by default).
        -A       Your DIFF program does not know the -a (Treat all files as
                 text) flag. Default: it knows.
                 The -a flag is needed in order to avoid false positive binary.
        -b char  Replace a blank in a MH folder name by `char', default `_'.
		 To remove all dots use `-b ""'
        -h       Show help piped through more
        -H       Show help.
        -d char  Replace a dot in a MH folder name by `char', default `-'.
		 To remove all dots use `-d ""'
        -D prog  Use `prog' for presenting differences.
                 Default: diff(1) if no DISPLAY variable is set, else
                          a graphical diff-utility is searched.
        -f       Force overwriting the `new' directory.
                 Default: it should not exist and is created by mh2maildir.
        -kmail   Create subdirectory names as used by kmail.
                 Default: use same names as used by MH.
                 This implies -R.
        -courier Create subdirectory names as used by courier-imap.
                 Default: use same names as used by MH.
                 This implies -R.
        -q       Be quiet.
        -r       Mark mails as read.
                 Default: mails are marked as unread.
        -R       Process recursively all subdirectories of `old'.
                 For each subdirectory of `old' a subdirectory in `new' with
                 the same name is created.
                 Default: only the MH files contained in `old' are processed.
        -U       Your DIFF program does not know the -u (Output NUM (default 3)
                 lines of unified context) flag.
                 DIFF is called with this flag only if differences between the
                 original and the processed file are found and if you don't
                 have the graphical diff-tools tkdiff, mgdiff or gvimdiff
		 installed.
        -v       Show version.

Arguments:
        old      The MH mail directory.
        new      The MAILDIR mail directory.
        folder   Store all mails below the `folder' of `new'.
                 Default: store them direct below `new'.

The integrity of the transformed mails is checked (using diff)
The timestamp of the new mail file is set to old one.
The MH mail files are not modified.

Important Notes:
  It's also a good idea to shut down your incoming mail delivery while
  you're doing this, or else your new messages will get into whatever
  folder you happen to be converting at the moment.

  You should not chose `new' to be equal `old'.

  This is the initial release of mh2maildir, so if you encounter some
  problems or if you have ideas for extensions, please drop me an email.

Example:
  Transform all mails below the directory Mail and its subdirectories
  and store them below the folder KMail/old. Mark all mails as read.
     mh2maildir -kmail -r -R Mail KMail old

  And the same thing to a courier-imap server
     mh2maildir -courier -r -R Mail EMAIL old

From the KMAIL FAQ:
  Can I configure the location of my mail directory?

  Exit KMail, make a backup of ~/.kde/share/config/kmailrc, then open it
  with an editor and add e.g. folders=/home/username/.mail to the "[General]"
  section. Then move all your existing folders (including the hidden index
  files) to the new location. The next time you start KMail it will use
  /home/username/.mail instead of /home/username/Mail. Note that KMail
  will lose its filters if you change the mail directory's location but
  forget to move your existing folders.

Credits:
  Thanks to Craig Dickson <crdic-at-yahoo.com> who gave me the hint using
  procmail to do the job.

  Thanks to Chris Wesseling <chris-at-araneum.nl>, Bruce C. Dillahunty
  <bdillahu-at-peachbush.com>, Marco Molteni <molter-at-tin.it>,
  Matthias Hessler <mail-at-mhessler.de>, Chris Horn
  <chorn-at-alumni.brown.edu>, David Carrel <carrel-at-SailPix.com>,
  T.Yoshida <deuce-at-metal.or.jp>, and "Vincent Untz" <vincent-at-vuntz.net>
  who all send me improvements and bug fixes (see also Log-entry at the end
  of this file).

Other information:
  Informations about the MAILDIR format may be found on
  the pages of D. J. Bernstein: http://cr.yp.to/proto/maildir.html

Version:
  1.13 of 2006/05/03

Author:
  Dr. Jürgen Vollmer <Juergen.Vollmer@informatik-vollmer.de>
  If you find this software useful, I would be glad to receive a postcard
  from you, showing the place where you're living.

Homepage:
  http://www.informatik-vollmer.de/software/mh2maildir.html

Copyright:
  (C) 2002 Dr. Jürgen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe, Germany

License:
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
© Copyright 2005 Dr. Jürgen Vollmer (www.informatik-vollmer.de)
This page was updated on March 09, 2012