FreeBSD Stable Release 6.0 Installer  Guide

Home______________________________________________________________________

 

Email Reading

FBSD has a built in mail client application called ‘mail’. To put this in perspective, the mail command is FBSD’s native version of the mail functions Microsoft Window users would think of as happening in Outlook. This client mail application is nowhere near as robust as Outlook. The basic mail subcommands necessary for you to work with your mail are covered. There are many other mail user agents (or UMAs) in the ports collection to chose from if you are going to use your FBSD system as a workstation. For the purpose of using your FBSD system as a gateway/firewall/email server/web server the built in email client application is more than adequate.

 

Using The Mail Command

The mail client application is a very simplistic command line driven system that assigns a sequence number to each individual mail message in your mailbox. This email message number is the key to manipulating your mail.

There are two methods of targeting the email message you want to manipulate: the explicit and implied. With the explicit method you can jump straight to the message you want to manipulate by message number. The implied method means the mail subcommands you enter apply to the last message you just viewed. You can switch between the two methods seamlessly with out any problems.

When you are creating a new message or replying to one, the text you enter is in <input mode> meaning the only way to correct a misspelled word two lines back is to use the backspace key to erase everything you entered between your current position and the position you want to correct. There is a procedure to work around this <input mode> limitation. The mail application does not have a built in spelling checker.

 

Checking Your Email

Most users get their first introduction to the FBSD mail command when they logon to the FBSD system and receive the ‘You have new mail’ message. Entering mail on the command line will bring up the ‘mailbox content’ display showing a list of all the mail in your mailbox. This ‘mailbox content’ display is refereed to in the mail application as the header list. It is the first 18 messages in your mailbox. You use the arrow keys to scroll through this list. If you have a lot of messages, use the + and – keys to scroll through the following groups of 18 messages each.

At the end of the header display you will see a blank line that starts with an ‘&’ (ampersand). This is the mail application's command line. Whenever you see this line you have the opportunity to issue commands to the mail application.

Normally you just hit enter and the first message in the header list will be displayed on your screen. Use the arrow or enter key to scroll through the message. When you reach the end of the message, the mail application command line is redisplayed. If you hit the enter key here, the next message will be displayed. If you hit the  d  key here, the message you just viewed will be deleted. If you hit the uppercase  R  key here, you will be able to reply back to the originator of the message you just viewed. If you hit the q key here, you will quit the mail system. All the messages you viewed will default to being moved from your MTA post office mailbox to the mbox file in your home directory. This is your archive file of viewed messages. All messages not viewed will remain in your MTA post office mailbox. All deleted messages vanish. A d * command before the quit command will delete all the messages in your mailbox.

 

Creating / Sending Your Email

There are four ways to create email messages. The most common is from the FBSD command line by entering 'mail user_account_name'. Mail will create a new email template using user_account_name as the targeted recipient of the message. Note: user_account_name can also be the complete email address of someone on the public Internet. The remaining three ways are from the mail system command line. You can enter the email user_account_name, or after viewing a message; enter uppercase R to Reply to the previous viewed message, or after locating the message number of the message you want to reply to in the header list; you can enter R message number. In all four cases a prompt line will return for a subject. Type in your subject title, then enter. The cursor returns with a blank line, and you are now ready to type in the body of your message.

If you want to include the contents of the implied previously viewed message into the body of your reply, you enter ~m on a blank line and hit enter, or ~m message number to include the contents of that message. The contents will be copied and inserted into the body of your reply beginning at that blank line and be shifted right by one tabstop from position 1 of the line.

Keep in mind that when entering text in the body of the message you are in <input mode>, meaning the only way to correct a missspelled word two lines back is to use the backspace key to erase everything you entered between your current position and the position you want to correct. If you let the line auto wrap for you, your message will be sent as one long line. You have to hit enter as you near the end of the line so it gets a carriage return to mark the end of the sentence. When you are finished, hit enter one more time so you have a blank line, then enter Ctrl + d keys at same time or use the period key followed by enter to end mail creation and send the email message.

An alternate method of entering the text for the body of the message that will allow you to use the arrow keys to edit text you have already entered is when you get the first blank line of your message body, enter ~e command to invoke your default editor. Now you have all the power of your editor to copy and paste text around and correct spelling anywhere in the text. When you are finished entering and editing your message text, exit your default editor and return to the mail application. You will still be in the mail enter text mode. Hit enter for the next blank line and enter Ctrl + d keys at same time to exit mail creation and send the message.

Sometimes you run out of time while composing your email. This mail application does not have a drift function where email in the process of being built can be saved & returned to at a later time. But, this function can be accomplished using the mail commands in this way.

When you're done entering the message body text for the time being, issue ~q command from the last blank line in the body text. This will save your message to your mbox file without sending it. Then exit the mail application issuing the q command. When you are ready to continue working on the unfinished message, issue mail –f on the FBSD command line. This will start the mail application using the mbox file. Review the mailbox content summary list to find the message number of the message you want to return to. On the mail command line enter 'mail user_account_name. The user_account_name is the same one used to build the original message. When you get to the first blank line of the message body, enter ~f message number of the message you want to continue with. This will copy the complete message headers and text into the body of your current message. You will not be able to see the copied text so now enter ~e to go into your default editor. Now you can see the complete message text header and all. There will be duplicate headers which you will have to delete. When you're finished and ready to send, exit your default editor and return to the mail application. You will still be in the mail message enter text mode. Hit enter for the next blank line and enter Ctrl + d keys at the same time to exit mail creation and send the message.

 

Mbox File

When you use the mail subcommand quit or q to leave the mail application, mail writes all the viewed undeleted messages to the mbox file in your home directory and removes them from your MTA post office mailbox. This is your archive file of viewed messages. When you want to access these saved archive messages in your mbox, issue mail –f from the FBSD command line. The mail application functions normally. It is just using a different mailbox file as source to the mail application.

When you quit by using the q key, mail writes undeleted messages back to this same file.

 

Mail Sub-commands

You can identify the mail application command line as the blank line that starts with the character ‘&’ (ampersand). The following mail application sub-commands have both explicit and implied usages. If there are no more messages, mail says ``at EOF''.

? or help Displays a brief summary of commands.

headers (h) Display ‘mailbox content’ screen. This is the current contents of the mailbox by range of headers, which is an 18-message group. If a `+' argument is given, then the next 18-message group is displayed, and if a `-' argument is given, the previous 18-message group is displayed. This display shows the message number of each message along with who the sender is, date & time it was received and the Subject.

n, numeric value of an explicit message number. Display that message.

hold (ho) Marks the viewed message to be saved in the user's MTA post office mailbox instead of being moved to the mbox archive file when the mail application is ended with quit command. Does not override the delete command.

delete (d) After viewing a message you can enter d to delete the previously viewed message. This is the implied usage of the command. You also could d 4 9 to delete message number 4 and message 9, or d 3-7 to delete messages 3 through 7. This is the explicit form of the command. Deletion causes the mail program to forget about the message. The special name `*' addresses all messages, and `$' addresses the last message, thus the command d * will delete all messages in the mailbox. This is not irreversible until you quit the mail application using the q command, after which the deleted messages disappear never to be seen again. The messages can be undeleted (u) by giving its message number, or the mail session can be aborted by giving the exit (x) command which will nullify the delete action.

Undelete (u) Takes an explicit message number or range of message numbers and marks each message as not being deleted. Note: This is a lower case u. u 5 or u 3 5 7 or u 4-23

unread (U) Takes a explicit message number or range of message numbers and marks each message as not having been viewed. Note this is an upper case U. U 5 or U 3 5 7 or U 4-23

quit (q) command ends the mail application. Messages which have been viewed go to the mbox file in your home directory. This is your archive file of viewed messages. Messages that have been deleted are discarded. Unviewed messages and messages marked with hold stay in your mailbox in the MTA post office. If new mail has arrived during the session, the message ``You have new mail'' is given upon return to the FBSD command line. If issued while using the mbox file (mail –f), then the file is rewritten to the mbox minus all deleted messages.

exit (ex or x) Effects an immediate return to the FBSD command line without modifying the user's MTA post office mailbox or mbox file. This nullifies all deletes and returns the mail box back to its original content condition before the mail command was issued.

edit (e) Takes an explicit message number and opens your default editor so you can edit the complete text of that message. On exit from the editor, the message replaces the original in the mailbox with the edited version.

Reply (R) Note that’s an uppercase R. Reply to originator, IE: the email address in the From: field. Does not reply to other recipients of the original message. This creates an empty message body for you to enter your reply message into.

 

Replying To or Creating New Email

While you are entering text into the body of the message, mail treats lines beginning with the character `~' as a command line. For instance, typing `~e' (alone on a line) will invoke the default text editor on the message built so far. Other ~commands will set up subject fields, add and delete recipients to the message and allow you to shell out to run some commands.

Some of these options are given in the summary below.

~e Invoke the text editor on the message built so far. After the editing session is finished, you may continue appending text to the message.

~f Copy the named messages into the message being sent. If no message number is specified, copy in the previously viewed message. You get headers and all text.

~m message number. Copy the numbered message body text into the message being built, indenting by one tab to the right. If no message number is specified, use the previous viewed message as the copy source. Message headers are not included.

~q Abort the message being built, do not send, and move the message to mbox in your home directory.

______________________________________________________________________

This FreeBSD Installer Guide is an public domain HOW-TO.  This content may be reproduced, in any form or by any means, and used by all without permission in writing from the author.