HowTos/Fetchmail

From Scalix Wiki
Revision as of 17:36, 16 October 2006 by Chris (Talk | contribs) (Fetchmail)

Jump to: navigation, search

Fetchmail

Fetchmail is a program used to relay messages from the server to which they were addressed to another destination without the message actually containing routing information to that final destination.

You can get fetchmail from http://fetchmail.berlios.de/. Your linux distribution almost certainly provides finished fetchmail packages as well, which you can install with yast, yum, up2date, apt-get or another program depending on your distribution. Refer to your linux system's documentation for further information on installing packages.

Once it is installed, fetchmail can either retrieve mail from specific mailboxes and deliver it to specific mailboxes, in what is called singledrop mode, or it can retrieve messages from one source mailbox and deliver them to multiple recipient mailboxes, in what is called multidrop mode. In this example we will configure single drop mode to retrieve messages from, and deliver them to, a single user.

There are two ways to configure fetchmail, the first is with a configuration file, the second is with parameters on the command line. We will use the command line in this example, although a configuration file could do the same job equally well.

Set Up Fetchmail

In order to retrieve and redeliver email fetchmail will need to know where messages are coming from and where they are going.

Let's say your messages are cached by an email provider, and you want to pick them up at regular intervals and put them in your Scalix inbox. You could use a fetchmail command something like this:

fetchmail -p pop3 -S yourserver.localdomain.com --smtpname your.name@localdomain.com -u youruser@provider.com popserver.provider.com

This command would retrieve all messages belonging to youruser@provider.com from your provider's server located at popserver.provider.com and deliver them to the your.name@localdomain.com mailbox hosted on the Scalix server yourserver.localdomain.com

If you want to leave the messages on your provider's server, and just copy them to your local server, add the -k flag to this command.

Automating Fetchmail

You can use the cron program to retrieve your messages on a regular basis.

Refer to chapter 9.4 of http://www.tldp.org/LDP/lame/LAME/linux-admin-made-easy/index.html for a thorough description of the cron daemon.

You can use a variant of

*/5 * * * * "/usr/bin/fetchmail -p pop3 -S yourserver.localdomain.com --smtpname your.name@localdomain.com -u youruser@provider.com popserver.provider.com >/dev/null 2>&1"

to cause fetchmail to retrieve and deliver mail every five minutes.

Rinse and repeat for each additional user