mhcompact
mhcompact
mhcompact makes Mail files smaller(MH style: supported by MH, Sylpheed, mew, Wanderlust ...). In my case, MH format files which occupied 61,257KB was able to become 51,257KB(cut down 7,148KB(12% )).
Some mail user agent(MH, mew, sylpheed, Wanderlust ...) manage mail messages with MH format. A MH format file has one message which has two part: header part, body part. Header part has many informations: FROM, TO, CC, BCC, RECEIVED, RETURN-PATH,...(see RFC822). These informations need some situations, but only for reading message(and for storing messages in your local disk spaces), some informations are unnecessary. mhcompact removes those informations from MH format file.
Requirement
- Ruby-1.6.x, 1.8.x
And also required MH format files :-p.
Usage
Before you execute this program, exit your mail user-agent and back up your mail directories.
$ chmod +x mhcompact $ cp -rf ~/Mail ~/Mail_org (Back up your mail directory) $ mhcompact ~/Mail (or ruby mhcompact ~/Mail)
The first parameter is mail directory. If you want to do only ~/Mail/inbox, you can execute it as follows.
$ mhcompact ~/Mail/inbox
mhcompact has a history for improvement in the speed. 1st time, the all files are taken as an object. But after 1st time, only new files are taken as an object. If you use "-a/--all" options, mhcompact ignores the history and takes all files as an object.
$ mhcompact -a ~/Mail/inbox
"-v/--version" or "-h/--help" options show an informations.
$ mhcompact -v
Customize
As default, mhcompact removes these headers:
Received, Delivered-To, Posted, Precedence, Lines, User-Agent, Resent, Return-Path, Errors-To, X-, Sender
except these headers:
X-Face, X-Mailer, X-UIDL
If you want to customize, edit mhcompact directly as follows.
remove_headers : Header name to remove.
For example, if you want to remove all the headers that starts by 'P' like "Posted","Precedence", then you add "P". Capital letters and small letters are disregarded.
As default, this value set as follows.
remove_headers = ["Received", "Delivered-To", "Posted", "Precedence", "User-Agent",
"Resent", "Return-path", "Errors-to", "X-", "Sender"]
not_remove_headers: Header name not to remove.
Though same name exist in delete_headers, the headers do not remove.
As default, some headers set as follows.
not_remove_headers = ["X-Face", "X-Mailer", "X-UIDL"]
This means that X-Face, X-Mailer, X-UIDL are not removed.
License
Copyright (C) 2002 Masao Mutoh <mutoh@highwhay.ne.jp>
This program is free software. You can distribute/modify this program under the terms of the GNU Lesser General Public License version 2 or later.
Change log
- 2001/10/27 Masao Mutoh <mutoh@highway.ne.jp>
-
- version 1.3
- save history in ~/.mhcompact/history.
- add -a, --all options.
- add -v/h, --version/help options.
- improve to print result.
- 2001/01/01 1.2
-
- Initial release of English version.
Keyword(s):
References:[YotaLab Storage]