Collect mails from other accounts

From Linuxintro

This article shows how you can collect e-mails from your accounts in the web to your local computer. It has been tested with SUSE Linux 10.3 but should work for other configurations as well.

To collect mails from pop accounts, we use fetchmail.

Install fetchmail

To install what we will need, run

yast -i procmail
yast -i fetchmail

Configure fetchmail

To configure it, use the file .fetchmailrc in your home directory. It should look like this:

poll pop.provider.net
        user "username@provider.net"
        pass "password"
        is localuser
        mda "/usr/bin/procmail -f fetchmail"

Replace

  • localuser with your local user on your Linux box.
  • pop.provider.net with your provider's pop server name.
  • username@provider.net with your mail address
  • password with your password at the provider

Then set the permissions for the file

chmod 710 .fetchmailrc

Configure procmail

Procmail is a mail delivery agent MDA. It works together with the MTA. An MTA can either store its mails on its own or hand the mails over to an MDA. The MDA can then call e.g. spam checkers before delivering (or not delivering) the mail. Write a file /etc/procmailrc with the following content:

LOGNAME=/var/log/procmail
DROPPRIVS=yes
DEFAULT=$HOME/Maildir/
MAILDIR=$HOME/Maildir/

Test procmail:

echo "this should be in your mailbox" | procmail

Now

grep "this should be in your mailbox" ~/Maildir/new/*

must deliver a match.

Call fetchmail

You need to know if your provider has a POP or an IMAP server for you. Or you need to try it out.

fetchmail -p POP3 -v pop.provider.net

Replace pop.provider.net by your provider's pop mail server.

fetchmail -p IMAP -v imap.provider.net

Replace imap.provider.net by your provider's imap mail server.