Website of latouche

[home] [Computers and networks] [tips]

fetchmail and ssl

Basic settings

fetchmail is a powerfull tool to retrieve your mails. I use it to for all my mail accounts. Mail are delivered to my local MTA.

You can specify your accounts in ~/.fetchmailrc (or whatever file you want by using fetchmail -f <your_file>) using the following syntax:

You can have, as an exemple, the following .fetchmailrc:
# use pop3 by default to get mails
protocol pop3

# first account
username "myusername"
password "PaSsWoRd"

# second account
username "myusername2"
password "pAsSwOrD"

# account using imap
protocol imap
username "myusername2"
password "pa55w0rd"

Because passwords are stored in this file, change the permissions on it so that you are the only one who can read it.

Add ssl support

You can easily retrieve your mail using ssl by adding the ssl keyword to your configuration:

# account with POPs
username "myusername"
password "PaSsWoRd"

You will maybe have the following error:

unable to get local issuer certificate
certificate not trusted
unable to verify the first certificate
This means that you don't have the root certificat in your ssl certificats path. You have to download it add add it to the list. By default, fetchmail looks at certificated in /etc/ssl/certs but you can specify an other by with sslcertpath <your_path> Once, you have added the certificate, call the c_rehash program (provided by OpenSSL suite) in you certificates directory.


The man of fetchmail will certainly answer your questions and give you new ideas.
Last update: 2007/03/30