man(1) Manual page archive


     MAILS(1)                                                 MAILS(1)

     NAME
          Mails, mail2fs, M, Mg, mspool, mailplumb, mails, Arch, Spam,
          Reply, Send - file based mail reader

     SYNOPSIS
          mail2fs [ -acDn ] [ -d mdir ] [ mbox ]

          mails [ -aAs ] [ mdir ] [ monthdir ]

          M cmd [ dir ... ]

          Mg [ -h ] [ regexp ]

          mspool

          mailplumb [ -dho ] [ mdir ]

          Mails

          Arch

          Spam

          Reply

          Send

     DESCRIPTION
          These programs cooperate to provide mail reading and deliv-
          ering facilities by using files from a shared file server.
          Mails 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
          In Plan B, mails for users are parsed and decoded first, and
          then stored in a file hierarchy where these and other tools
          can be used to process them.  A mailbox is a directory, usu-
          ally under /mail/box/$user/, that contains one directory per
          month (e.g., 200603/ for mails processed on March 2006). In
          these diretories there is one directory per message. The
          convention is that (message directory) names starting with
          `a.'  correspond to archived messages not to be usually
          shown to the user. Names starting with `s.'  correspond to
          messages that seem to be spam (not usually shown either).
          Other messages use a serial message number as their direc-
          tory name.

          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

     MAILS(1)                                                 MAILS(1)

          headers without any processing, including the UNIX header
          line (for debugging and also for obtaining message ids when
          replying to mails).  Any attachment in the mail is kept
          stored in a separate file (possibly with the file name indi-
          cated 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 mails 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 read-
          ing.

          There is no provision for storing mail flags in the Plan B
          mailbox format.  However, the convention is that messages
          with the same last modification time for both the text file
          and the directory are not yet read. Using touch(1) on the
          text file ``flags'' the message as read.

          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 mul-
          tiple programs using the mail box.  The file digest contains
          digests for mails added to the mailbox using mail2fs (and
          not for those added by hand using file tools).  When a mes-
          sage has a digest that was already seen in the past the mes-
          sage is silently discarded as a dupplicate.

          Programs described below are parsimonious enough in the for-
          mat 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.

        Reading mail
          Mail is converted from a Plan 9 mailbox into a Plan B mail-
          box using mail2fs. This program may be run using cron(8) or
          directly from the pipeto file described in mail(1). It uses
          upas/fs, described in upasfs(1), to parse the Plan 9 mail
          box.

          Without arguments it uses /mail/box/$user/mbox as the source
          (Plan 9) mail box and moves all messages from there to
          /mail/box/$user/msgs (in Plan B mailbox format).  Supplying
          mbox as an argument would use that file as the source

     MAILS(1)                                                 MAILS(1)

          instead.  Using option -d permits to use mdir as the desti-
          nation instead.

          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 the messages as archived to the
          Plan B mailbox. This is useful to add messages to a mailbox
          for further reference and not for listing when asking the
          mail index for the mailbox. For example, to archive outgoing
          mail in the default mail box.

          The program mails is a convenience tool for reading mail. It
          generates a mail index. Flag -a generates a list for all
          mails in the mailbox, archived or not.  Unread mails are
          flagged by an initial `N' character (new) in the mail index.
          Flag -A includes spam as well. The mailbox is the standard
          msgs inbox unless a different one is supplied as an argu-
          ment.  As an option, both the mail box path and the name of
          a per-month directory can be indicated to ask mails for a
          list of mails for just that month.

          As an aid for other programs, mails places a list of the
          directories for the mails listed at /tmp/mails.$user, which
          can be useful for retrieve the paths for the mails the user
          is working with.

          M is a script that applies the operation indicated by cmd to
          one or more mails. It applies cmd to all mails last listed
          by mails, (as described by the paths in /tmp/mails.$user),
          when no mail directories are given as arguments. Arguments
          selecting mails only need to mention the path to the mail
          directories, but may refer to particular files within them,
          as a convenience to permit pasting names from somewhere else
          without editing.  Cmd may be any of the following:

          arch   To archive the mails as read.
          spam   To archive the mails as spam.
          inbox  To archive the mails as unread.
          rm     To print commands to remove the mails.
          print  To print the text of the mails.
          list   To list the directories for the mails.
          mime   To list the attachments for the mails.
          reply  To plumb a reply message to the editor.
          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 conve-
          nience script to call grep(1) to locate mails containing the
          expression given as an argument. Flag -h makes it search
          only in headers. Like the previous program, Mg considers

     MAILS(1)                                                 MAILS(1)

          just the mails listed in /tmp/mails.$user.
          Mailplumb is used to send plumb(1) messages to maintain
          faces(1) and other programs aware of the mails in the user's
          Plan B mailbox, or in mdir when supplied. Flag -h makes the
          program notify existing mails as new ones.  Flag -o makes
          mailplumb post events for the Octopus, using ports(4)
          instead of plumber(4).

        Reading mail in O/live
          Several scripts are provided which, used from olive(1),
          implement a user interface for reading and sending mail.

          Executing !Mails at /mail/box/$user/msgs produces an initial
          list of mails. This list can be refreshed by executing
          ,<Mails in the panel containing the mail list.  To read a
          mail just click (button-3) on the mail path.

          To select mails according to text shown in the mail index
          use the Sam command language. For example, ,x/9fans/+-p pro-
          duces a mail index for mails comming from `9fans'.

          To archive a set of mails send their index text as standard
          input to Arch. For example, ,>Arch archives all mails listed
          in the panel.  In the same way, Spam flags mails as spam.

          Both Arch and Spam can be executed at the panel showing a
          single mail to archive and to flag as spam the mail shown.

        Sending mail
          Mspool is a program that takes text files from
          /mail/box/$user/out reprensenting mails to be sent, and
          sends them. It only operates on files whose names are num-
          bers. To send a mail, the user creates a file with a random-
          ized name like /mail/box/$user/out/Out.3452, edits it, and
          renames the file to just the random number.

          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 mails should contain a Replying: header containing
          the path to the mail being replied to (its raw file in a
          Plan B mailbox).  Using multiple addresses (separated by
          white space) within a single To header causes the mail to
          sent to each different address as a different message (each
          receiver will not see others). This header line may be
          repeated to cause the message to be sent to a group of users
          (so that any of them gets all the recipient list).

          Messages are sent using marshal(1).

     MAILS(1)                                                 MAILS(1)

          The script Reply is available to send messages from
          olive(1). Similar to Arch and Spam, it replies to the mail
          shown in a panel when executed for that panel (e.g., !Reply)
          and to the mail listed in its standard input otherwise. For
          example, selecting a mail in the index and executing .>Reply
          would reply to it.  When uncertain regarding the mail to
          reply, it would simple open an empty panel to  create a new
          mail.

          Mail is delivered by writing the panel created by Reply and
          then executing !Send on that panel.

     EXAMPLES
          Move all mails from the Plan 9 mailbox to the Plan B one,
          and creates the later if it does not exist.
          ; mail2fs -c

          List mails:
          ; mails omsgs
          200712/4/text       Ralph Corderoy  Re: [9fans] Hi
          200712/3/text       Juan Manuel Se  Re: reunion
          200712/2/text       "Raquel Martin  Re: [Diet] reunion
          200712/1/text       "Fco. J. Balle  reunion

          From now on, /tmp/mails.$user contains a list of mail direc-
          tories for M to work with. For example, display them.
          ; M p
          /mail/box/nemo/msgs/200712/4
          To: 9fans@cse.psu.edu
          From: Ralph Corderoy <ralph@inputplus.co.uk>
          Subject: Re: [9fans] Hi together | a few newbie questions
          Sender: 9fans-admin@cse.psu.edu
          ...
          ;

          List their directories and plumb all PDF attachments:
          ; M l
          /mail/box/nemo/msgs/200712/4
          /mail/box/nemo/msgs/200712/3
          /mail/box/nemo/msgs/200712/2
          /mail/box/nemo/msgs/200712/1
          ; plumb `{M l}^*.pdf

          Reply to the second, mark the first as spam, and archive the
          others.
          ; M r 200712/3
          ; M s 200712/4/text
          ; M a
          ;

          Prepare to use the script M (like above) but only for mes-
          sages from december 2007 that contain PDF attachments and

     MAILS(1)                                                 MAILS(1)

          are kept in the omsgs mailbox:
          ; ls /mail/box/nemo/omsgs/200712/*/*.pdf >/tmp/mails.nemo
          ;

          Use mailplumb to see in faces messages in the Plan B mail-
          box:
          ; plumber
          ; mailplumb
          ; faces -m /mail/box/$user/msgs

          This is a guide for reading mail using olive(1):
          !Mails    # ask for mail index
          !Arch     # archive this mail
          !Spam     # mark this mail as spam
          X/text/D  # delete all panels showing mails
          , <Mails  # update mail index
          , >Arch   # archive all mails listed
          , x/9fans/+-p  # list all 9fans messages shown

     FILES
          /mail/box/$user/mbox     Standard Plan 9 mail box for the
                                   user.
          /mail/box/$user/msgs/    Standard Plan B mail box for the
                                   user
          /tmp/mails.$user         List of mails being processed by
                                   the user.

     SOURCE
          /sys/src/cmd/mail2fs

     SEE ALSO
          mail(1).