- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Tell Us What You Think!
- Introduction
- Part I: Introduction to Mac OS X
- Chapter 1. Mac OS X Component Architecture
- Chapter 2. Installing Mac OS X
- Chapter 3. Mac OS X Basics
- Chapter 4. The Finder: Working with Files and Applications
- Chapter 5. Running Classic Mac OS Applications
- Part II: Inside Mac OS X
- Chapter 6. Native Utilities and Applications
- Chapter 7. Internet Communications
- Chapter 8. Installing Third-Party Applications
- Part III: User-Level OS X Configuration
- Chapter 9. Network Setup
- Chapter 10. Printer and Font Management
- Chapter 11. Additional System Components
- Part IV: Introduction to BSD Applications
- Chapter 12. Introducing the BSD Subsystem
- Chapter 13. Common Unix Shell Commands: File Operations
- Part V: Advanced Command-Line Concepts
- Chapter 14. Advanced Shell Concepts and Commands
- Chapter 15. Command-Line Applications and Application Suites
- Chapter 16. Command-Line Software Installation
- Chapter 17. Troubleshooting Software Installs, and Compiling and Debugging Manually
- Chapter 18. Advanced Unix Shell Use: Configuration and Programming (Shell Scripting)
- Part VI: Server/Network Administration
- Chapter 19. X Window System Applications
- Chapter 20. Command-Line Configuration and Administration
- Chapter 21. AppleScript
- Chapter 22. Perl Scripting and SQL Connectivity
- Chapter 23. File and Resource Sharing with NetInfo
- Chapter 24. User Management and Machine Clustering
- Chapter 25. FTP Serving
- Chapter 26. Remote Access and Administration
- Chapter 27. Web Serving
- Part VII: Server Health
- Chapter 28. Web Programming
- Chapter 29. Creating a Mail Server
- Chapter 30. Accessing and Serving a Windows Network
- Chapter 31. Server Security and Advanced Network Configuration
- Chapter 32. System Maintenance
- Appendix A. Command-Line Reference
- Appendix B. Administration Reference
Mail Clients
Depending on how your machine is configured, you might not have a use for the first e-mail reading command discussed in this chapter. It is detailed here partly for historical completeness, and partly because it is an excellent utility for your use, if you have the opportunity to use it.
The mail program is an e-mail reading and sending program that works on e-mail that is actually received and managed by your local machine. If all you've ever used is a POPmail or IMAP client, such as Eudora or Mailsmith, you're probably unfamiliar with the idea of your local machine being its own e-mail server. Unix machines have, since the dawn of e-mail, been part of the backbone by which e-mail makes its way around the Internet. Configured properly, they don't need POPmail servers, they are POPmail (and IMAP) servers. E-mail gets around between them by way of the SMTP (Simple Mail Transfer Protocol), and is delivered (with a few minor exceptions) directly from the sender's machine to the receiver's machine.
What does this mean to you? If your machine is set up to receive and deliver mail itself, mail doesn't arrive at 10-minute intervals (or however frequently you have your POPmail client configured to connect). It arrives as instantaneously as it can make its way across the Internet—usually within a few seconds of being sent. It doesn't require your ISP's mail service to be up and running for you to receive mail because you (for e-mail purposes) are your own ISP. Old-time Unix users are frequently amused by the instant messaging services that seem to be all the rage as the hot new Internet technology. Unfettered by the POPmail and IMAP protocols, plain old e-mail is an instant messaging technology.
Building Block Simplicity: mail
The mail program is a simple command-line program for sending and reading e-mail. Invoked with no arguments, its default behavior is to display the list of messages in your system mailbox, and provide you with a prompt from which further interaction can occur. Used in this fashion, mail will produce output similar to the following:
rodan joray 205> mail
Mail version SMI 4.0 Fri Oct 14 12:50:06 PDT 1994 Type ? for help.
"/var/spool/mail/joray": 11 messages 11 new
>N 1 joray Tue Nov 7 08:30 14/296 testing
N 2 joray Thu Nov 9 10:30 15/359 testing new sendmail
N 3 joray Thu Nov 9 10:43 15/384 another test
N 4 joray Thu Nov 9 11:00 13/370 another test...
N 5 joray Thu Nov 9 11:21 15/402 Testing sendmail and geth
N 6 MAILER-DAEMON Thu Nov 9 11:32 64/2324 Returned mail: see transc
N 7 joray Thu Nov 9 11:40 15/480 testing gethostbyaddr fix
N 8 MAILER-DAEMON Thu Nov 9 11:42 65/2283 Returned mail: see transc
N 9 joray Thu Nov 9 11:55 14/374 testing...
N 10 joray Thu Nov 9 12:13 14/407 Hi there.
N 11 joray Tue Dec 19 13:00 14/374 hi there
&
The & on the last line is the internal mail prompt from which you can enter commands.
At the & prompt internal to mail, you have a number of options. These include the expected functions of reading, sending, and deleting messages, as well as a few others. Table 15.6 details command options available for the mail program.
Table 15.6. The Command Documentation Table for mail
| Sends and receives mail | |
mail [-iInv] [-s <subject>] [-c <cc-addr>] [-b
<bcc-addr>] <to-addr>...
mail [-iInNv] -f [<name>]
mail [-iInNv] [-u <user>]
mail
|
|
| -I | Ignores tty interrupt signals. Especially useful for communication on noisy phone lines. |
| -I | Forces interactive mode, even when input isn't a terminal. Particularly useful for using the ~ character, which is only available in interactive mode. |
| -n | Ignores /etc/mail.rc upon startup. |
| -v | Verbose mode. |
| -s <subject> | Specifies the subject. Uses only the first argument after the flag. Be certain to use quotes for any subjects with spaces. |
| -c <cc-addr> | Sends a carbon copy to the users specified in <cc-addr> . |
| -b <bcc-addr> | Sends a blind copy to the users specified in <bcc-addr> . The list should be a comma-separated list. |
| -f [ <name> ] | Reads the contents of your mbox or the file specified by <name> . When you quit, mail writes undeleted messages back to this file. |
| -u <user> | Equivalent to -f /usr/mail/<user>. |
| Here are some of the useful options available within mail: | |
| - <n> | Displays the previous message, if <n> is not specified; otherwise, displays the <n> th previous message. |
| ? | Displays a brief summary of commands. |
| help | Same as ?. |
| ^D | Sends the composed message. |
| ! <shell_command> | Executes the shell command that follows. |
| <return> | |
| n | |
| + | Goes to the next message in sequence. |
| Reply | |
| R | Replies to the sender of the message. Does not reply to any other recipients of the message. |
| reply | |
| r | Replies to the sender and all other recipients of the message. |
| respond | Same as reply. |
| mail <user> | |
| m | Sends mail to the <user > specified. Takes login names and distribution group names as arguments. |
| delete | |
| d | Takes as its argument a list of messages and marks them to be deleted. Messages marked for deletion are not available for most other commands. |
| dp | |
| dt | Deletes the current message and prints the next message. |
| undelete | |
| u | Takes a message list as its argument and unmarks the messages for deletion. |
| edit | |
| e | Takes as its argument a list of messages and points a text editor at each one in turn. |
| inc | Checks for any new incoming messages that have arrived since the session began and adds those to the message list. |
| save | |
| s | Takes as its argument a list of messages and a filename and saves the messages to the filename. Each message is appended to the file. If no message is given, saves the current message. |
| write | |
| w | Similar to save, except saves only the body of messages. |
| unread | |
| U | Takes as its argument as list of messages and marks them as not read. |
| alias | |
| a | With no arguments, prints out the list of currently defined aliases. With one argument, prints out the specified alias. With multiple arguments, creates a new alias or edits an old one. |
| unalias | Takes as its argument a list of names defined by alias commands and discards the remembered groups of users. |
| exit | |
| ex | |
| x | Exits mail without making any changes to the user's mbox, system mailbox, or the -f file that was being read. |
| xit | Same as exit. |
| quit | |
| q | Terminates the session, saving all undeleted messages in the user's mbox. |
Full-Featured Power: pine
pine is a command-line-based modern e-mail client. It provides access to system mailboxes, as well as remote (or local if you choose) POPmail and IMAP servers. The pine e-mail client provides an interface that will be much more familiar to users of applications such as Eudora. Although text-based, it provides a menu driven interface with multiple mailboxes, sophisticated filtering, and other friendly conveniences. As of this writing, Apple doesn't distribute pine as a default application with OS X, but it's a popular enough mail client that many sites will have it installed. If you're playing system administrator for your own machine, the installation of pine is covered later in this chapter.
pine, being a menu-driven, windowed system, doesn't lend itself to command documentation tables, so we give you a pair of screenshots from the running program. Figure 15.1 shows the first pine screen you'll see when you start it up. Unless you have sendmail working properly, don't press the Return key to send the requested statistic information!
Figure 15.1 The initial pine window. From this window, you can choose from any of the keys shown at the bottom to start using the program.
Figure 15.2 shows the more typical pine screen from which you'll work. You can choose items from the textual menu shown on the screen, and also choose commands from those shown at the bottom of the screen. One thing that you should be aware of is that pine usually expects you to go back to get out of any situation. It's sort of like wandering around on the Web—there isn't necessarily a link back to the first page from any subpages several layers down in the system. Look for options that take you to the previous screen and so on to assist in navigating the system.
Figure 15.2 The normal top-level window for the pine e-mail reading program.
Text Editors | Next Section

Account Sign In
View your cart