Solaris Resources at Kempston
Installing and configuring fetchmail on Solaris 7 and Solaris 8
| www.kempston.net/solaris/ | www.kempston.org/solaris/ |
Introduction
Fetchmail is a brilliant program which collects incoming email from one or more POP3 servers and injects it into sendmail running on your local system for final delivery to the user. Before implementing fetchmail, please ensure that you've correctly configured sendmail for outgoing mail.
Fetchmail is supplied in source form and you need to compile it. This isn't difficult! Before doing so, you need to have installed the g(un)zip program, a C compiler and flex. All of these are freely downloadable from the Net and instructions for installing C, gzip and flex are here.
Installing fetchmail
The source of fetchmail is available from http://www.tuxedo.org/~esr/fetchmail/. At the time of writing, the latest 'Gold' version is V5.3.0 and the source code is provided as a compressed tar archive in the file fetchmail-5.3.0.tar.gz. Download the "Gzipped source archive of fetchmail 5.3.0" to a temporary directory, such as /tmp.
Make a directory at a convenient point in the file system to hold the source code and copy the source into this directory. For example:
# mkdir -p /opt/source/fetchmail # cd /opt/source/fetchmail # cp /tmp/fetchmail-5.3.0.tar.gz .
Unzip and untar the source and then change to the directory created by tar:
# gunzip fetchmail* # tar xvf fetchmail* # cd fetchmail-5.3.0
At this point, you may like to have a look at the README, INSTALL and FAQ files.
Configure the compilation process for your system:
# ./configure
Compile the source code:
# make
Note that this may take a few minutes and you can ignore any 'makedepend' error messages. If this step fails with:
lex ./rcfile_l.l "./rcfile_l.l":line 190: Error: Too many positions
you need to replace Sun's broken lex with flex. See installing gzip, C and flex for details, install flex, delete all the files in your fetchmail source directory except the .tar file and start again.
Finally, install the compiled code:
# make install
This install the binaries into /usr/local/bin and the manual page into /usr/local/man.
You now need to modify the search paths so that the system can find the fetchmail program and its manual page. If you're running the CDE windowing system, this is done by editing the file /.dtprofile and adding the following lines (if they aren't already there) to the end of this file:
PATH=$PATH:/usr/local/bin:/usr/ccs/bin MANPATH=$MANPATH:/usr/man/:/usr/local/man
It's advisable to log out and log in again at this point to activate these changes. Make sure that the system can find the fetchmail program:
# fetchmail -V
and that you can display the extensive manual page:
# man fetchmail
fetchmail is extremely powerful and there are numerous options to control its behaviour. It's well worth reading through the manual page quickly to gain some idea of how it works and studying the manual page later at your leisure. If you're impatient, the following instructions should be sufficient to get you going.
fetchmail is controlled by its configuration file /.fetchmail.rc which contains instructions to connect to one or more POP3 servers, how to log in to them and what to do with the incoming mail which the program retrieves from these servers.
It's easiest to explain what needs to be put in this file by considering an example. Suppose that your email address is kempston@zulu.com, that your ISP's POP3 server is named pop.zulu.com, that your mailbox on the POP3 server is called kempston, that your password is secret and you want mail addressed to kempston@zulu.com to be delivered to user mike on your Solaris system.
The following /.fetchmailrc file:
poll pop.zulu.com protocol pop3, user kempston with password secret, is mike here
tells fetchmail to connect to the POP3 server at pop.zulu.com, log in to the server as user kempston with a password of secret, retrieve all mail messages waiting for delivery and inject the messages into your local sendmail for delivery to local user mike. There are a few 'noise' words on that line, such as "with", "is", "here" and the punctuation marks. These aren't necessary but make the line easier to read and understand.
If you have several mailboxes on one POP3 server, or mailboxes on several POP3 servers, you can put as many lines as you like in the /.fetchmailrc file, one line per mailbox.
So use CDE's text editor to create your /.fetchmailrc file and the configuration is nearly done. Don't forget to study the manual page some time to see what else you can configure.
After you've created .fetchmailrc, change its permissions:
# chmod 0600 /.fetchmailrc
Try:
# fetchmail -V
which displays the program's version number and option settings, and when online to your ISP:
# fetchmail -v -c
which connects to your ISP's POP3 server and displays how many mail messages are awaiting collection without actually retrieving or deleting any messages.
If you connect to your ISP by means of a dial up script, as described in Configuring PPP on Solaris to connect to an ISP, add a line to the end of the /dialup script reading:
fetchmail -v -d 120 -L /var/log/fetchmail.log
This starts fetchmail in background (daemon) mode and tells it to connect every 2 minutes (120 seconds) to the POP3 servers defined in the /.fetchmailrc file and check for new mail. Of course, you can adjust the time interval as desired.
Create the log file by:
# touch /var/log/fetchmail.log
Finally, arrange to stop fetchmail when you disconnect from your ISP by inserting the following line at the start of your /hangup script:
pkill fetchmail
The pkill command was introduced in Solaris 7. If you're using an earlier version of Solaris, use the following command instead:
kill `ps -e | grep fetchmai | awk '{print $1}'`
Before going online to your ISP for the first time with fetchmail active, it's a good idea to monitor its actions by:
# tail -f /var/log/fetchmail.log
And that's it. Have fun!
Fetchmail is so simple to install and configure that it's easy to overlook its considerable power and flexibility. Don't forget to check the fetchmail man page and the FAQ file which you'll find in the program's source directory. The latest FAQ is also available on the Web at http://www.tuxedo.org/~esr/fetchmail/fetchmail-FAQ.html
Has this guide been useful?
I hope these instructions prove useful. If you have any comments or suggestions for improvement, or have found any technical errors, please email me at mike@kempston.net
This page is copyright © mike@kempston.net 2000. Reproduction is forbidden without the author's permission. You are welcome to link to these pages if you wish but please point to the pages at www.kempston.net: Solaris Resources at Kempston
| Home | Free Solaris | Connecting to an ISP |
| Configuring mail | Configuring modem dialup | Configuring a PPP server |
| Installing Software | Solaris FAQs and Software | Site Index |
This page is maintained by the
Kempston Webmaster
Last updated 10 December 2000