Downloading POP Mail with fetchmail

You’re running your own POP or IMAP mail server but don’t have any way of getting your mail from your ISP to your local machine. fetchmail, a popular Unix utility, will fetch your mail for you.

In our ever-connected world, people are rabid about email. “Did you get my email?” they clamor. “Did you read my message?” they beg. “I just sent you an attachment!” they announce. Granted, Apple has thoughtfully included its own nice email program with its latest OS, but you can also check your mail via the Terminal [Hack #48] using a popular utility called fetchmail.

By itself, fetchmail does nothing more than fetch your mail. For those not familiar with the shell, it does even this not so simply, as you’ve got to know about mail directories and how things work together. Where fetchmail really shines, however, is when it’s used in combination with other hacks in this email chapter — combining fetchmail with a local IMAP or POP mail server [Hack #81] creates a powerful one-two punch for email independence.

Getting fetchmail running is easy when you have some hand-holding. The first thing we’ve got to do is create our storage file; this is the place fetchmail will fetch our mail to. This, conveniently enough, is called a mailbox . In OS X and most operating systems like it, this mailbox file is located under the var directory — something you normally wouldn’t see through the Finder. To set up your mailbox file so you have adequate permissions, perform ...

Get Mac OS X Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.