mdfrm-utf8

(List From and Subject of mail in a maildir in Unicode)

SYNOPSIS

mdfrm-utf8 [-hvcdnsu] [maildir]

mdnfrm-utf8 [-hvcds] [maildir]

REQUIREMENTS

Perl 5.8.0 or newer is required, including the Encode and Encode::Guess modules. If you want to use the -d option, the Date::Parse module (part of the TimeDate distribution on CPAN) is also required.

DESCRIPTION

mdfrm-utf8 prints the name from the From header and the Subject header of all mail stored in a given maildir sorted by arrival date. If no maildir is specified on the command line, mdfrm will default to the path in the environnment variable MAILDIR or to a default path of $HOME/Maildir (configured at the top of this script). If invoked as mdnfrm-utf8 (or nfrm), see the description of the option -n below.

If the From or Subject headers are encoded per RFC 2047, they're decoded into UTF-8 before display. Otherwise, mdfrm-utf8 will attempt to guess the character set of the From and Subject headers by attempting several character sets in order. The default character sets tried (and the default order) is EUC-KR, Big5, GB2312, ISO-2022-JP, Shift JIS, and ISO-8859-15, in that order. The first character set that doesn't result in invalid sequences will be used. The character sets and order can be modified at the start of this script.

mdfrm-utf8 will attempt to adjust the formatting for Asian character sets that xterm renders using a wide font. The range of Unicode characters considered wide is set at the beginning of this script in case it needs modification.

OPTIONS

-c

Rather than displaying a summary of the messages, just print a single line giving the count of messages. This option works in conjunction with -n and -u in the expected ways. If you want to see both the count and the summary, also use -s.

-d

Sort the displayed summary by the Date: headers of the mail rather than by arrival date. Use of this flag requires the Date::Parse module be installed (part of TimeDate). (If you do not use this flag, you do not need that module.)

-h

Show a usage summary.

-n

Limit the summary to new (unread) messages (messages located in the new subdirectory of the maildir and excluding messages in the cur subdirectory). This option is the default if this program is invoked as mdnfrm or nfrm (or any other name containing "nfrm").

-s

Print a summary of messages. This is the default behavior; this option is only needed in combination with -c if you want to see both the count of messages and the summary.

-u

Only show messages which haven't been seen (read with a mail client). This uses the status flags in the info section of a message name (the part after :2,). See <http://cr.yp.to/proto/maildir.html> for more information on status flags.

This option doesn't really make sense in combination with -n since new messages by definition haven't been read and a mail client should move messages into the cur subdirectory when the user looks at them.

-v

Show the program version.

DIAGNOSTICS

cannot open %s

mdfrm was unable to open the specified file or directory. This can happen if the specified maildir was incorrect, or if mail was being read while mdfrm was running and some of the messages were moved or deleted while it was retrieving Subject or From headers.

only one maildir argument supported

More than one maildir was specified on the command line. Currently, mdfrm can only summarize one maildir at a time. To summarize multiple maildirs, run mdfrm multiple times with different arguments.

unknown flag %s

An unknown command-line flag was passed to mdfrm.

EXAMPLES

Summarize all of the mail in MAILDIR ($HOME/Maildir if MAILDIR isn't set):

    mdfrm

Display only the new messages in the maildir Mail/incoming, sorted by the Date headers rather than by file name (arrival time):

    mdfrm -nd

Display a count of unseen messages (in both the new and cur directories):

    mdfrm -cu

Show the count and summary of unseen messages, sorted by date.

    mdfrm -csd

If maildirs are used exclusively on your system, it may be a good idea to install mdfrm as frm.

ENVIRONMENT

MAILDIR

The path to the maildir to summarize, used if no maildir is given on the command line.

BUGS

mdfrm-utf8 assumes that the output character set should be UTF-8 and does not support any other locale.

The ordering of character sets when guessing, and the character sets attempted, should be configurable from the command line or via the environment, not only by modifying the script.

The list of wide characters is not complete and needs to be further elaborated based on the Unicode data tables.

Continuation lines are not handled in either Subject or From, even if the full header content would fit on a single line.

SEE ALSO

frm(1), maildir(5), xterm(1)

The maildir format is documented at <http://cr.yp.to/proto/maildir.html>.

<http://www.eyrie.org/~eagle/software/mdfrm/> will have the current version of this program.

AUTHOR

Russ Allbery <rra@stanford.edu>

COPYRIGHT AND LICENSE

Copyright 1997, 1998, 2002, 2003, 2007 by Russ Allbery <rra@stanford.edu>

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

THANKS

Mikko Hänninen and Sverre H. Huseby helped with the initial RFC 2047 decoding logic (no longer used). Support for nfrm (-n) courtesy of Vebjørn Ljoså. Support for Date header sorting (-d) inspired by the work of Matthew Mead. Documentation and usage message based on work by Sotiris Vassilopoulos. Implementation of -u, -c, and -s from Russell Steinthal.

Last spun 2022-12-12 from POD modified 2007-08-01