MH & nmh: Email for Users & Programmers

May, 2006

Sending Some Mail: comp, send

First, let's try the comp command, the usual way to compose a message in MH. If you'd like, look ahead to the Example Using the comp command; it shows how your screen will look when you finish typing.

Start by typing the command at a shell prompt. When you do, you'll be prompted for the addresses where you want to send the message, as the following example shows:

    % comp
    To:
    
NOTE: If someone has changed the configuration of MH on your computer or your account, your comp may be a little different. For example, it might put you into a full-screen editor.

Pick someone to send the message to and type that person's address at the prompt. Type a comma, and then put your username next in the field. This means the message will be sent to the person you chose and to you. Press RETURN.

Next, you'll be asked who should get a "carbon" copy (cc:) of this message. Leave it blank -- let's not send a cc: of this message. Just press RETURN.

You'll get a Subject: prompt next. The people who receive your messages can get a quick idea about your messages from the subjects. It's a good idea to spend a moment and think of descriptive subjects. For this message, you might type something like "Test message from Joe and the MH system." Or for now, just type something fun....

When you press RETURN, you'll see a row of dashes, and your cursor will be on the line below them. Your screen should look something like this:

    % comp
    To: yourfriend, you
    cc:
    Subject: Thoroughly trivial experimentation
    --------
    
Messages have two parts. One is the header -- you just filled that in. The parts of a header (the lines starting with To:, Subject:, and so on) are called header fields. The other part is the body -- the contents of the message.

Now you can type the body. In MH, unless your MH profile is set up differently, comp uses a "text collector" program called prompter to collect the message header and body from you. prompter is a simple-minded program, and it doesn't understand how to do things like word wrap. You'll need to press RETURN at the end of every line of the body. (If you can't wait, the Section Replying to Messages: repl shows how to start a standard text editor like vi that has built-in word wrapping. You may also want to read What now? -- and the whatnow Program and Changing Default Editors.)

After you've typed the short message, you should press RETURN so that the cursor is at the start of a new line. Press CTRL-D to end the body. (Actually, you use the end-of-input character. On some systems, this might not be CTRL-D. If you're not sure, ask a local expert.) Also, with MH Version 6.7 or later, you can set prompter to end input with a single dot (.) at the start of a line -- see Editing the Draft with prompter.

Next comes the What now? prompt, which is where you tell MH what to do with the draft message you just typed:

The Example below shows what all that should look like.

Example: Using the comp command

    To: yourfriend, you
    cc:
    Subject: Thoroughly trivial experimentation
    --------
    In the interest of furthering the educational
    objectives and enlightenment of the above-stated
    personage, the current electronic communication has
    been rendered.  May I obtain a response?

    John

    P.S.  Yow!!

    ^D

    --------
    What now? send
    %
    

Finally, send a long mail message to yourself. An easy way to do that is by using a UNIX pipe (made with the | character) to send the output of a command to mhmail. The mhmail command doesn't prompt you; it takes the addresses and subject from its command line. It reads the message body from its standard input -- such as your terminal, or text redirected from a pipe or a file. In this example, send a fairly long manual page from the man command. Put your username and the subject A long message on the command line:

    % man awk | mhmail yourname -subject "A long message"
    %