mailtools

mailtools are going to become my replacement for fetchmail, procmail and so on. Like most of my tools it started as a perl or shell script and was rewritten and published in C for minimum execution size and maximum execution speed since most other tools are far too heavyweight for my taste although they are more powerful than mine.
At the moment mailtools consists just of one programm, mailfetch, which sucks messages from a POP3 server and pipes it to a local mail delivery agent, which then feeds your mails to cyrus, courier or your local mailbox.

usage

$ mailfetch [-c <config file>] <mail delivery agent> [<args to mda> ...]

If you do not specify a config file, ~/.mailfetch will be used. So, for example:

$ crontab -l
*/5 * * * * mailfetch /var/qmail/bin/qmail-inject mylocalaccountname
A typical ~/.mailfetch looks like:
# this is a comment :-)
pop3://yourusername:yourpassword@pop.yourprovider.tld
# maybe the pop3 server listens on a non-default port:
pop3://yourusername:yourpassword@pop.yourinsaneprovider.tld:666

It does not download messages exceeding 20 MB in size which is a compile time default.

compile

$ diet -Os gcc -W -Wall -s -pipe -o mailfetch mailfetch.c

download

mailfetch.c