Table of Contents
- About the Lead Authors
- About the Contributing Authors
- Tell Us What You Think!
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
With imapd set up on your server, you can access your mail using numerous methods. You can use a command-line program such as Pine on the Linux console, an IMAP-compliant Windows or Macintosh-based email client (a list of which can be found at http://www.imap.org/products.html), or Netscape Communicator, which is available as part of the Red Hat Linux distribution.
Configuring Netscape for POP3 or IMAP Retrieval
It's fairly simple to set up Netscape to talk to your mail server. You just need to tell it your IMAP or POP server name, your login name, and if you want to use IMAP, the subdirectory in your home directory on the server where your folders are kept.
Start off by logging in to your account and creating a directory called Mail:
[fred@gonzo] $ mkdir Mail
You will use this directory to store your mail folders so they can be accessed by both your local email client and remote IMAP client.
Now start up Netscape. Just type in netscape and it should start up. If you get a command not found error, you will need to install it from your Red Hat CD-ROMs.
Click the Communicator menu and select Messenger Mailbox. This will bring up the Netscape messaging system. Now click on Edit, Preferences, and click Identity in the left half of the screen. You will be faced with a dialog box like that shown in Figure 10.3.
Put your real name in. This name is what will be placed in the From: header for email messages you send out. Also, fill in your correct email address. This is the address that people will see in the From: header.
Click Mail Servers and you will see a window similar to Figure 10.4.
Figure 10.3 Setting your identity with Netscape Messenger.
Figure 10.4 Setting your Mail Servers details with Netscape Messenger.
In the first text box, enter the username that you use on your mail server. Now you need to enter your outgoing (SMTP) server name. Delete the given Incoming mail server and click Add. That will bring up a screen similar to Figure 10.5. Enter the incoming server name (these two are usually the same). Directly below the information you just entered, you can choose the incoming mail server type. For demonstration purposes, choose IMAP—but you can just as easily choose POP3 if you don't want or need all the neat IMAP features. Using the tabs across the top, you can set the features that protocol supports such as choosing to move your deleted messages into your Messenger trashcan, selecting SSL encryption if your IMAP server supports it, or selecting Set New Folders for Offline Download. This allows you to download messages so they physically reside on your local PC as well as the server for offline reading.
Figure 10.5 Configuring an IMAP connection.
If you're using IMAP there is one final option that needs to be set before you can begin reading your email with Messenger. Click the Advanced Options tab and, in the IMAP server directory, enter the directory you created at the start of this section (Mail). This is the directory that Messenger will use for your online mail folders. Click OK, click OK again, and click the Get Msg button. Messenger will ask for your password and then will begin to download all your email message headers and display them for easy browsing. You can then easily switch to different folders using the drop-down box just under the toolbar.
fetchmail is best described with an example. Say your email is stored for you at your ISP. To access your mail using conventional means, such as with Netscape Messenger, you set it up for POP3 access. That way, when you dial in it will download all your messages to your personal Linux account so you can read, reply, and sort through your messages as you please.
The fetchmail paradigm is slightly different. Instead of downloading your mail using your mail reader, fetchmail is executed as a separate program whose sole purpose is to log in to your POP3 or IMAP server and download all your messages. But that's not all it does! As it downloads your mail, each message is passed on to your regular Mail Delivery Agent (MDA). If you use sendmail, qmail, smail, or some other SMTP-compatible mail server, all the messages are passed to port 25 on your local Linux machine, just as if you were permanently connected on the Internet and email was arriving directly to your machine. Once the mail is delivered to your mail spool file (/var/spool/mail/ <username>), you can read it using conventional methods, such as command-line mail, elm, pine, or even Netscape Messenger on a Windows or Macintosh machine elsewhere on your local LAN—long after you have disconnected from your ISP!
This method of mail pickup provides numerous benefits. If you use procmail scripts to filter incoming messages as they arrive and your sendmail is configured to use procmail as the local delivery mailer, your messages will be filtered correctly. Again, if you are using sendmail and you have a .forward file in your home directory, it will be processed.
fetchmail is a very powerful program, and it has many advanced features that we will not go into here. But if you want more information on what it offers, there is a reasonable amount of documentation in /usr/doc/fetchmail-x.y.z (x, y, and z are the version numbers of the version you have installed).
To check if fetchmail is installed on your system, enter the following command:
[root@gonzo /] # rpm -q fetchmail fetchmail-5.5.0-2
If similar output appears, you are in business. Otherwise, install it from your Red Hat CD-ROMs using a similar command to
[root@gonzo /] # rpm -i fetchmail-5.5.0-2.i386.rpm
Configuring fetchmail for POP3 or IMAP Retrieval
When fetchmail executes, it searches for a .fetchmailrc file in your home directory. This file usually contains all the options that are needed to log in to your ISP's POP or IMAP server. Anything that can be specified in this rc file can also be specified on the command line, but it is usually easier to put all the options you regularly use in a .fetchmailrc file. To start off, create a configuration file to collect your mail from your ISP's POP3 server. It is fairly simple:
poll pop.isp.net protocol pop3 username joe password secret123
This is fairly self-explanatory. poll signifies the hostname to contact, protocol gives the protocol that you want to use to connect, username specifies your POP3 username, and password indicates that your password follows. If you want, you can leave your password out. If you choose to do it this way, you will be asked for a password when fetchmail connects to your POP3 server.
Similarly, it is not hard to guess how to configure fetchmail to retrieve your mail from an IMAP server:
poll imap.isp.net protocol imap username joe password secret123
For security, you should also make sure you have the correct permissions on your .fetchmailrc file:
$ chmod 0400 .fetchmailrc
You can also start up fetchmail as a daemon and it can automatically check your mail once every n seconds with the option -d. For example, to check your mail automatically every minute and put fetchmail in the background, use the following command:
$ fetchmail -d 60 &
To help diagnose mistakes, the -v option comes in handy. It outputs diagnostic information to the screen as it works to help you narrow down a problem.
fetchmail has an excellent manual page for more details on how to configure some of the more advanced options. There are also numerous resources on the Internet, such as http://www.tuxedo.org/~esr/fetchmail.
The easiest way to configure fetchmail is via fetchmailconf:
[root@gonzo /] # rpm -q fetchmailconf fetchmailconf-5.5.0-2
Then make sure you're running the X Window System and run fetchmailconf in your normal user account. A GUI will come up that will give you access to almost every configuration option.