The q command entered at the next mail prompt ends the session and returns you to the shell prompt. But take note of the messages that were printed on your way out: namely, Saved 1 message in /home/hermie/mbox and Held 2 messages in /var/mail/spool/hermie. For some odd reason, mail does not think it's a good idea to keep the mail you've already read in the /var/spool/mail/hermie file, so it moves read mail to a separate file called mbox in your own home directory. To access the messages in the mbox file, you have to use the command
mail -f mbox
Kind of annoying, ain't it? But at least the mail program looks and acts the same regardless of which mail file you're working with.
Other Mail Commands
Let's get back into the mail program and have some fun with the two messages that we didn't read before with this scenario (again, bold type represents your input):
Mail version 5.6 6/1/95. Type ? for help.
"/var/spool/mail/hermie": 1 message 1 new
>U 1 D.Rhodes@spam.net Mon Feb 10 15:37 "Make Money Fast!"
U 2 Chris@qwerty.com Mon Feb 10 15:37 "Tennis, Anyone?"
Date: Mon, 10 Feb 1997 15:37:52 -0500
Subject: Tennis, Anyone?
Wanna whack a few a 4:30 today? -Chris
Subject: Re: Tennis, Anyone?
Sure, I'll see you on the lower courts at 4:30.
U 1 D.Rhodes@spam.net Mon Feb 10 15:37 "Make Money Fast!"
>O 2 Chris@qwerty.com Mon Feb 10 15:37 "Tennis, Anyone?"
& delete 1
Saved 1 message in /home/hermie/mbox
We've introduced several new commands here, so let's take a closer look at the five operations that were performed in this mail session:
· As soon as I started the mail program, the mail headers were displayed, showing that both messages are marked U for unread. I displayed message 2 by entering a 2 at the prompt.
· The reply command responded with an appropriate Subject line for message 2, Subject: Re: Tennis, Anyone?, and waited for me to enter the text of my message to Chris. Pressing ctrl-D makes EOT appear and sends my reply.
· The header command displays the message headers. I've used it here to show the difference in the status flags. The > indicates that message 2 is current, and the message is marked as O for old.
· I deleted the first message with delete 1 without even reading it, since the Subject line was rather dubious.
· And as a parting gesture, the q command told me that another message was squirreled away in that mbox file. At this point, if I issued the mail command again, the system would respond:
No mail for hermie
Poor hermie. He needn't drink Draino, though--he can always send himself some more mail. ;-)>
Comments - most recent first
|Linux Sending Email - Linux Commands|
|Pine Email - Linux Commands|
|Linux Reading Email - Linux Commands|