NAME
|
Msgs, mail2fs, M, Mg, mspool, mailplumb, msgs, Arch, Spam, Reply,
Send, Post, Delmesg, Save – file based mail reader |
SYNOPSIS
|
mail2fs [ –acDnor ] [ –d mdir ] [ mbox ] msgs [ –aD ] [ –s runes ] [ mdir ] [ monthdir ] M cmd [ dir ... ] Mg [ –h ] [ regexp ] mspool mailplumb [ –dho ] [ mdir ] Msgs [ –a ] [ mdir [ monthdir ] ] Arch [ file ... ] Spam [ file ... ] Reply Send Delmesg [ file ... ] Post Save file
mlist |
DESCRIPTION
|
These programs cooperate to provide mail reading and delivering
facilities by using files from a shared file server. Msgs are
stored in a convenient way to read or process them just by browsing
files, using a Plan B mail box format. Mail box format The directory for a message contains at least two files: text and raw. The text file has the mail headers and body already processed for reading, and raw has the original mail headers without any processing, including the UNIX header line (for debugging and also for obtaining message ids when replying to msgs). As an option, raw may contain the entire original mail without processing and not just the headers. Any attachment in the mail is kept stored in a separate file (possibly with the file name indicated in the MIME headers) ready to be used, that is, decoded. When the attachment is a mail, the message is stored in a subdirectory following the same conventions stated above. For msgs with attachments, the text file contains additional text indicating the relative path names (from the mail's directory) that can be used to open the attachments. This is convenient to plumb(1) them while reading. Because all these files have been already processed for reading, the usual file handling tools can be used to read, edit, copy, or remove them. The mailbox used by default is /mail/box/$user/msgs, and corresponds to the inbox. A Plan B mail box also contains two files: seq and digest. Messages are given sequence numbers as added to the mail box. The file seq contains the sequence number for the last message (or zero) and is DMEXCL to provide locking for multiple programs using the mail box. The file digest contains digests for msgs added to the mailbox using mail2fs (and not for those added by hand using file tools). When a message has a digest that was already seen in the past the message is silently discarded as a dupplicate. Programs described below are parsimonious enough in the format of the mail box so that they will work even if messages are edited by hand, other files are created, or some of them are removed. Virtual mail folders may be created by storing text files with mail lists that contain a mail description per line starting with the path for each mail. Copying the text shown for some messages in a mail listing into another text file would ``save'' such messages into that file. The program mlist writes to standard output a clean listing for messages with paths found in the standard input.
A file (a virtual folder) named like a per–month directory with
.l or .la appended is considered a cache of the listing for that
directory. But only if the directory has not been modified after
the file. For example, a text file named 200909.l (containing
a mail listing in the format shown by msgs ) will be used to list
msgs on September 2009, instead of the 200909 directory and its
contents. This file will be ignored for mailbox listings if the
directory is modified after the file and the cache is, therefore,
out of date. A file named 200909.la behaves like before, but is
known to contain only archived msgs. It is, therefore, ignored
when listing non–archived msgs. The msgs program automatically
renames .l files to la when the file lists only archived mail. Reading mail By default /mail/box/$user/mbox is the source (Plan 9) mail box. Messages found on it are moved into (in Plan B mailbox format). The argument mbox specifies another mail source, to be used instead of the default. Option –d changes the destination to mdir. Messages are deleted from the Plan 9 mailbox unless flag –n is given. The Plan B mailbox is created if it does not exist only if flag –c is given. Flag –a makes mail2fs add new messages as archived to the Plan B mailbox. This is useful to add messages to a mailbox for further reference, not for listing when asking the mail index for the mailbox. For example, to archive outgoing mail in the default mail box. Flag –o asks mail2fs to use the date from the mail to determine where to archive it, instead of using today's. See the examples section. Flag –r asks mail2fs to store the entire original message in the raw file, and not just message headers. Flag –D (accepted by mail2fs and other programs) enables debug diagnostics. The program msgs is a convenience tool for reading mail. It generates a mail index. Flag –a generates a list for all msgs in the mailbox, archived or not. This may take some time if the mailbox is is big enough. Flag –s can be used to include in the list msgs starting with any rune in runes, for example, s for spam. The mailbox is the standard msgs inbox unless a different one is supplied as an argument. As an option, both the mail box path and the name of a per–month directory can be indicated, to ask for a list of msgs for just one month. This is useful to generate per–month mail lists that can be used to quickly browse existing msgs without going through all msgs in the box. See the Month script supplied as an example. As an aid for other programs, msgs places a list of the directories for the msgs listed at /tmp/msgs.$user, which can be useful for retrieve the paths for the msgs the user is working with. Programs just described are the basic toolkit to handle msgs. Other programs described here are a convenience for the user. Users are encouraged to customize them and/or to write their own versions.
M is a script that applies the operation indicated by cmd to one
or more msgs. It applies cmd to all msgs last listed by msgs,
(as described by the paths in /tmp/msgs.$user), when no mail directories
are given as arguments. Arguments selecting msgs only need to
mention paths to the mail directories, but may refer
to particular files within them, as a convenience, to permit using
names from somewhere else without editing. Cmd may be any of the
following: The single letters a, s, i, d, p, l, m, and r can be used instead of the full cmd name (in the same order). Note that the letter is the initial for the command, but for deletion. Mg is not strictly necessary, but is supplied as a convenience script to call grep(1) to locate msgs containing the expression given as an argument. Flag –h makes it search only in headers. Like the previous program, Mg only considers msgs listed in /tmp/msgs.$user. Mailplumb is used to send plumb(1) messages to maintain faces(1) and other programs aware of msgs in the user's Plan B mailbox, or in mdir when supplied. Flag –h makes the program notify existing msgs as new ones. Flag –o makes mailplumb post events for the Octopus, using ports(4) instead of plumber(4). Reading mail in Acme The program listens to plumber events for mail and tries to maintain the mail list up to date. To read a mail simply click button–3 on the mail file name shown in the mail list. Archiving, marking a spam, replying, and deleting messages is achieved by executing the scripts Arch, Spam, Reply and Delmesg respectivelly. Most of them may be used either from a message window or to process standard input (usually at the mail box directory). Some of them also accept message paths as arguments. For example, to archive a series of msgs, select them in the mail list and execute |Arch in that window. Msgs can be sent using Reply and Post as described later.
Save archives one or more messages, adding them to the named file. Reading mail in O/live Executing !Msgs at /mail/box/$user/msgs produces an initial list of msgs. This list can be refreshed by executing ,<Msgs for the panel containing the mail list. To read a mail just click (button–3) on the mail path. To select msgs according to text shown in the mail index use the Sam command language. For example, ,x/9fans/+–p produces a mail index for msgs comming from 9fans. To archive a set of msgs send their index text as standard input to Arch. For example, ,>Arch archives all msgs listed in the panel. In the same way, Spam flags msgs as spam.
As in Acme, most scripts can be used for a panel showing a single
message, for standard input, or for messages given as argument. Sending mail The file format is similar to that used by the acme(1) mail composition window. It includes one text line per header, a blank line, and the body. Attachments are added by lines starting with Attach: in the header. Inline attachments are added by lines starting with Include: in the header. Replies to other msgs should contain a Replying: header containing the path to the mail being replied to (its raw file in a Plan B mailbox). Messages are sent using marshal(1). The script Reply is available to send messages from either olive(1) or acme(1). Similar to Arch and Spam, it replies to the mail shown when executed in a message window (or panel); it replies to the mail listed in its standard input otherwise. For example, selecting a mail in the index and executing .>Reply in Olive or >Reply in Acme would reply to it. When uncertain regarding the mail to reply to, it creates a window to edit and send a new mail.
Mail is delivered by writing the panel created by Reply and then
executing either Send or Post. The former spools the message using
mspool , the latter attempts to immediatelly deliver the message. |
EXAMPLES
|
Users are expected to customize the scripts supplied to their
needs. All of them are to be considered examples of how to use
the mail system.
Move all msgs from the Plan 9 mailbox to the Plan B one, and creates
the later if it does not exist.
List msgs:
From now on, /tmp/msgs.$user contains a list of mail directories
for M to work with. For example, display them.
List their directories and plumb all PDF attachments:
Reply to the second, mark the first as spam, and archive the others.
Prepare to use the script M (like above) but only for messages
from december 2007 that contain PDF attachments and are kept in
the omsgs mailbox:
Use mailplumb to see in faces messages in the Plan B mailbox:
This is a guide for reading mail using olive(1): The script /sys/src/cmd/mail2fs/Month is an example of a per–month cleanup script. Usually the directory for the last month is declared as DMTEMP and this permission is cleared when all spam has been dealt with. The script also creates cached listings for all but the current month.
Add msgs from the UNIX–format oldmbox to the standard msgs folder,
honoring their dates and inserting them as archived, and produce
a listing for them kept at newfolder
Create a cache for September, 2009, to be used by tools listing
msgs. |
FILES
|
/mail/box/$user/mbox Standard Plan 9 mail box. /mail/box/$user/msgs/ Standard Plan B mail box. /tmp/msgs.$user List of msgs being processed by the user. |
SOURCE
|
/sys/src/cmd/upas/mail2fs and /acme/msgs |
SEE ALSO
|
mail(1). |