2. Reading Mail

This section covers how to use inc, show, scan, next, prev, rmm, rmf, and msgchk. One of the best things about MH is the consistent interface between programs. One thing to keep in mind when using these commands is how to specify message lists. In the case of inc this does not really make any sense but with commands like show it is useful to know.

A message list can consist of something like 23 20 16 which will act on messages 23, 20 and 16. This is fairly simple but you can do more useful things like 23-30 which will act on all the messages between 23 and 30. You can also specify something like cur:10 which will act on the current message and the next 9 messages. The cur, last, and first messages are special messages that refer to the current, last or first message in the folder.

2.1. inc, msgchk—read in your new email or check it

If you just type in inc and hit return you will be well on your way to getting started with MH. The first time you run inc it will set up your account to use all the MH defaults and ask you about creating a Mail directory under your HOME directory. If you have mail waiting to be downloaded you will see something that looks like:

  29  01/15 Doug White         Re: Another Failed to boot problem<<On Mon, 15 J
  30  01/16 "Jordan K. Hubbar  Re: FBSD 2.1<<> Do you want a library instead of
  31  01/16 Bruce Evans        Re: location of bad144 table<<>> >It would appea
  32  01/16 "Jordan K. Hubbar  Re: video is up<<> Anyway, mrouted won't run, ev
  33  01/16 Michael Smith      Re: FBSD 2.1<<Nate Williams stands accused of sa

This is the same thing you will see from a scan (see Section 2.3, “scan—shows you a scan of your messages”). If you just run inc with no arguments it will look on your computer for email that is supposed to be coming to you.

A lot of people like to use POP for grabbing their email. MH can do POP to grab your email. You will need to give inc a few command line arguments.

% inc -host mail.pop.org -user username -norpop

That tells inc to go to mail.pop.org to download your email, and that your username on their system is username. The -norpop option tells inc to use plain POP3 for downloading your email. MH has support for a few different dialects of POP. More than likely you will never ever need to use them though. While you can do more complex things with inc such as audit files and scan format files this will get you going.

The msgchk command is used to get information on whether or not you have new email. msgchk takes the same -host and -user options that inc takes.

2.2. show, next and prev—displaying and moving through email

show is to show a letter in your current folder. Like inc, show is a fairly straightforward command. If you just type show and hit return then it displays the current message. You can also give specific message numbers to show:

% show 32 45 56

This would display message numbers 32, 45 and 56 right after each other. Unless you change the default behavior show basically just does a more on the email message.

next is used to move onto the next message and prev will go to the previous message. Both commands have an implied show command so that when you go to the next message it automatically displays it.

2.3. scan—shows you a scan of your messages

scan will display a brief listing of the messages in your current folder. This is an example of what the scan command will give you.

  30+ 01/16 Jordan K. Hubbar   Re: FBSD 2.1<<> Do you want a library instead of
  31  01/16 Bruce Evans        Re: location of bad144 table<<>> >It would appea
  32  01/16 Jordan K. Hubbar   Re: video is up<<> Anyway, mrouted won't run, ev
  33  01/16 Michael Smith      Re: FBSD 2.1<<Nate Williams stands accused of sa

Like just about everything in MH this display is very configurable. This is the typical default display. It gives you the message number, the date on the email, the sender, the subject line, and a sentence fragment from the very beginning of the email if it can fit it. The + means that message is the current message, so if you do a show it will display that message.

One useful option for scan is the -reverse option. This will list your messages with the highest message number first and lowest message number last. Another useful option with scan is to have it read from a file. If you want to scan your incoming mailbox on FreeBSD without having to inc it you can do scan -file /var/mail/username. This can be used with any file that is in the mbox format.

2.4. rmm and rmf—remove the current message or folder

rmm is used to remove a mail message. The default is typically to not actually remove the message but to rename the file to one that is ignored by the MH commands. You will periodically need to go through and physically delete the removed messages.

The rmf command is used to remove folders. This does not just rename the files but actually removes the from the hard drive so you should be careful when you use this command.

2.5. A typical session of reading with MH

The first thing that you will want to do is inc your new mail. So at a shell prompt just type in inc and hit return.

% inc
Incorporating new mail into inbox...

  36+ 01/19 Stephen L. Lange   Request...<<Please remove me as contact for pind
  37  01/19 Matt Thomas        Re: kern/950: Two PCI bridge chips fail (multipl
  38  01/19 Amancio Hasty Jr   Re: FreeBSD and VAT<<>>> Bill Fenner said: > In
%

This shows you the new email that has been added to your mailbox. So the next thing to do is show the email and move around.

% show
Received: by sashimi.wwa.com (Smail3.1.29.1 #2)
        id m0tdMZ2-001W2UC; Fri, 19 Jan 96 13:33 CST
Date: Fri, 19 Jan 1996 13:33:31 -0600 (CST)
From: "Stephen L. Lange" <stvlange@wwa.com>
To: matt@garply.com
Subject: Request...
Message-Id: <Pine.BSD.3.91.960119133211.824A-100000@sashimi.wwa.com>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


Please remove me as contact for pindat.com

% rmm
% next
Received: from localhost (localhost [127.0.0.1]) by whydos.lkg.dec.com (8.6.11/8
.6.9) with SMTP id RAA24416; Fri, 19 Jan 1996 17:56:48 GMT
Message-Id: <199601191756.RAA24416@whydos.lkg.dec.com>
X-Authentication-Warning: whydos.lkg.dec.com: Host localhost didn't use HELO pro
tocol
To: hsu@clinet.fi
Cc: hackers@FreeBSD.org
Subject: Re: kern/950: Two PCI bridge chips fail (multiple multiport ethernet
 boards)
In-Reply-To: Your message of "Fri, 19 Jan 1996 00:18:36 +0100."
             <199601182318.AA11772@Sysiphos>
X-Mailer: exmh version 1.5omega 10/6/94
Date: Fri, 19 Jan 1996 17:56:40 +0000
From: Matt Thomas <matt@lkg.dec.com>
Sender: owner-hackers@FreeBSD.org
Precedence: bulk


This is due to a typo in pcireg.h (to
which I am probably the guilty party).

The rmm removed the current message and the next command moved me on to the next message. Now if I wanted to look at ten most recent messages so I could read one of them here is what I would do:

% scan last:10
  26  01/16 maddy              Re: Testing some stuff<<yeah, well, Trinity has
  27  01/17 Automatic digest   NET-HAPPENINGS Digest - 16 Jan 1996 to 17 Jan 19
  28  01/17 Evans A Criswell   Re: Hey dude<<>From matt@tempest.garply.com Tue
  29  01/16 Karl Heuer         need configure/make volunteers<<The FSF is looki
  30  01/18 Paul Stephanouk    Re: [alt.religion.scientology] Raw Meat (humor)<
  31  01/18 Bill Lenherr       Re: Linux NIS Solaris<<--- On Thu, 18 Jan 1996 1
  34  01/19 John Fieber        Re: Stuff for the email section?<<On Fri, 19 Jan
  35  01/19 support@foo.garpl  [garply.com #1138] parlor<<Hello. This is the Ne
  37+ 01/19 Matt Thomas        Re: kern/950: Two PCI bridge chips fail (multipl
  38  01/19 Amancio Hasty Jr   Re: FreeBSD and VAT<<>>> Bill Fenner said: > In
%

Then if I wanted to read message number 27 I would do a show 27 and it would be displayed. As you can probably tell from this sample session MH is pretty easy to use and looking through emails and displaying them is fairly intuitive and easy.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.