► main.cf
— The principal configuration script for Postfix. Within the remarks at the start of the script, you are advised to change only a couple of options at any time. This is sage advice, given that there are more than 300 possibilities!
► master.cf
— The throttle control for Postfix. This script enables you to change settings for Postfix that directly affect the speed at which it works. Unless you have a reason to tinker with this file, leave it alone. Trust me: You will know when you need to make changes.
► postfix-script
— The script used by Postfix as a wrapper. You cannot execute it directly; instead it is called by Postfix itself.
You can keep your original Sendmail aliases file for use with Postfix because it will not make much difference to it.
You will also require the services of system-switch-mail
, which can also be installed by using yum
.
After system-switch-mail
has been successfully installed, switch to a root terminal and type the following:
# system-switch-mail
You are then greeted with a simple text screen, asking which MTA you want to use. Select Postfix and simply press Enter. After a few seconds, a new window appears, informing you that your MTA has been successfully switched. All you then need to do is ensure that Postfix is enabled in runlevel 5 by checking the service ( system-config-services
).
Further configuration of Postfix focuses on the main.cf
file, which is extensively documented throughout the file using comments.
The beauty of Postfix is that it can be used in any situation from a single home user to a large corporation that has thousands of clients, even up to the ISP level. It can even be linked to MySQL for authentication purposes and virtual hosting.
Using Fetchmail to Retrieve Mail
SMTP is designed to work with systems that have a full-time connection to the Internet. What if you are on a dialup account? What if you have another system store your email for you and then you log in to pick it up once in a while? (Most users who are not setting up servers are in this situation.) In this case, you cannot easily receive email with SMTP, and you need to use a protocol, such as POP3 or IMAP, instead.
NOTE
Remember when we said that some mail clients can include some MTA functionality? Microsoft Outlook and Outlook Express can be configured to use SMTP and, if you use a dialup connection, offer to start the connection and then use SMTP to send your mail. Therefore, a type of MTA functionality is included in those mail clients.
Unfortunately, many MUAs do not know anything about POP3 or IMAP. To eliminate that problem, you can use a program called Fetchmail to contact mail servers using POP3 or IMAP, download mail off the servers, and then inject those messages into the local MTA just as if they had come from a standard SMTP server. The following sections explain how to install, configure, and use the Fetchmail program.
Similar to other packages, Fetchmail can be installed with the yum install
command. This command installs all files to their default locations. If, for whatever reason, you need to perform a custom installation, see Chapter 34, "Advanced Software Management," for more information on changing the default options for rpm
.
You can get the latest version of Fetchmail at http://fetchmail.berlios.org. It is available in both source and RPM binary formats. The version of Fedora on the DVD accompanying this book provides a reasonably current version of Fetchmail and installs useful Fetchmail documentation in the /usr/share/doc/fetchmail
directory. That directory includes an FAQ, features
list, and Install
documentation.
After you have installed Fetchmail, you must create the file . fetchmailrc
in your home directory, which provides the configuration for the Fetchmail program.
You can create and subsequently edit the . fetchmailrc
file by using any text editor. The configuration file is straightforward and quite easy to create; the following sections explain the manual method for creating and editing the file. The information presented in the following sections does not discuss all the options available in the . fetchmailrc
file, but covers the most common ones needed to get a basic Fetchmail installation up and running. You have to use a text editor to create the file to include entries like the ones shown as examples — modified for your personal information, of course. For advanced configuration, see the man
page for Fetchmail. The man page is well written and documents all the configuration options in detail.
CAUTION
The . fetchmailrc
file is divided into three different sections: global options, mail server options, and user options. It is important that these sections appear in the order listed. Do not add options to the wrong section. Putting options in the wrong place is one of the most common problems that new users make with Fetchmail configuration files.
Configuring Global Options
The first section of . fetchmailrc
contains the global options. These options affect all the mail servers and user accounts that you list later in the configuration file. Some of these global options can be overridden with local configuration options, as you learn later in this section. Here is an example of the options that might appear in the global section of the . fetchmailrc
file:
set daemon 600
set postmaster foobar
set logfile ./.fetchmail.log
The first line in this example tells Fetchmail that it should start in daemon mode and check the mail servers for new mail every 600 seconds, or 10 minutes. Daemon mode means that after Fetchmail starts, it moves itself into the background and continues running. Without this line, Fetchmail would check for mail once when it started and would then terminate and never check again.
The second option tells Fetchmail to use the local account foobar
as a last resort address. In other words, any email that it receives and cannot deliver to a specified account should be sent to foobar
.
The third line tells Fetchmail to log its activity to the file ./.fetchmail.log
. Alternatively, you can use the line set syslog
— in which case, Fetchmail logs through the syslog
facility.
Configuring Mail Server Options
The second section of the . fetchmailrc
file contains information on each of the mail servers that should be checked for new mail. Here is an example of what the mail section might look like:
poll mail.samplenet.org
proto pop3
no dns
The first line tells Fetchmail that it should check the mail server mail.samplenet.org
at each poll interval that was set in the global options section (which was 600 seconds in our example). Alternatively, the first line can begin with skip
. If a mail server line begins with skip
, it is not polled as the poll interval, but is polled only when it is specifically specified on the Fetchmail command line.
The second line specifies the protocol that should be used when contacting the mail server. In this case, we are using the POP3 protocol. Other legal options are IMAP, APOP
, and KPOP
. You can also use AUTO
here — in which case, Fetchmail attempts to automatically determine the correct protocol to use with the mail server.
Читать дальше