this is obsolete doc -- see http://doc.nethence.com/ instead

Getmail configuration 

 

http://pbraun.nethence.com/doc/mail/fetchmail.html 

http://pbraun.nethence.com/doc/mail/getmail.html 

http://pbraun.nethence.com/doc/mail/procmail.html 

 

 

Getmail v4 installation 

Make sure Python is installed, 

rpm -q python
which python

 

As root, download, compile and install getmail (http://pyropus.ca/software/getmail/), 

wget http://pyropus.ca/software/getmail/old-versions/getmail-4.20.0.tar.gz
tar xzf getmail-4.20.0.tar.gz
cd getmail-4.20.0
python setup.py build
python setup.py install

 

 

Getmail v4 configuration 

As user, edit the configuration, 

cd ~/
mkdir -p .getmail
cd .getmail
vi getmailrc

note. ~/.getmail/account_name alernatively 

for example, 

[options]
delivered_to = 0
received = 0
read_all = 0
message_log_syslog = 1
message_log_verbose = 0

 

verbose = 1
delete = 0
#delete messages 15 days after first seeing them,
#delete_after = 15

 

 

[retriever]
type = SimplePOP3Retriever
server = POP3SRV
username = LOGIN
password = PASSWORD

 

[destination]
type = MDA_external
path = /usr/bin/procmail
arguments = ("-f", "%(sender)")
unixfrom = 1

note. 'delivered_to' and 'received' disabled to prevent getmail from adding its lines to the messages 

note. 'read_all' disabled not to download the same message over again at each retrieval 

note. if prefer to centralize the logs with syslog. But if you like, 

#message_log = ~/.getmail/getmailrc.log

note. eventually change procmail's path 

note. to ingnore message's Content-Length field add this argument to procmail, 

"-Y",

note. if using alternate procmailrc files (other than ~/.procmailrc) add e.g. that at the end, 

"-m", "/etc/procmailrc.mailuser"

note. if you need to switch user & group before delivering the messages (you need to be root for that), 

#user = fred
#group = mail

 

Fix the perms, 

cd ~/.getmail
chmod 600 getmailrc
#chmod account_name

 

 

Usage 

Make sure procmail is configured and call getmail to fetch the messages, 

getmail

Note. '-v' to force verbose output 

Note. 'getmail -r account_name' alternatively 

 

Once everything works, you may erase the previous downloads and finish up the configuration, making getmail more silent and delete the mail after 15 days, 

cd ~/.getmail
vi getmailrc

change, 

verbose = 0
delete = 0
#delete messages 15 days after first seeing them,
delete_after = 15

 

 

Automation 

Two solutions depending on your needs. 

 

Server needs 

Make it happen periorically, 

crontab -e

add e.g., 

*/5 * * * * /usr/bin/getmail

 

Workstation needs 

For workstation usage, it's useless to look for messages all the time if you're not there. Use this script instead, 

vi ~/bin/getmail.ksh

like e.g., 

#!/bin/ksh
set -e
while true; do
  date
  getmail -v
  #-r account_name
  sleep 60
done

fix perms, 

chmod +x getmail.ksh

Note. eventually keep this in a screen window, 

(screen) ^A c

Note. or use nohup and kill the process when quitting, 

nohup getmail.ksh > /dev/null
#pkill or kill when you leave

 

 

References 

http://pyropus.ca/software/getmail/configuration.html#conf-options 

http://pyropus.ca/software/getmail/faq.html 

http://www.ososo.de/filtergetmail/ 

http://en.gentoo-wiki.com/wiki/Getmail 

 

FDM 

http://blog.etoilebsd.net/tag/fdm 

http://wiki.archlinux.org/index.php/Fdm 

 

Animail 

http://animail.sourceforge.net/