Reading local mail in OS X

Problem: Cron jobs send their output to the local mailbox of the user running the cron job. It would be nice to have these appear in Mail.app.

Typical Solution: Google the problem, find an appropriate link (usually on the first page of results) and implement solution. Bookmark for future reference.

However, when I applied the Typical Solution this time around, most of the search results were for versions of OS X pre-10.5. Many of them mention file permission tweaks and other things you need to do in order to get sendmail or postfix to deliver the email correctly. Some also refer to setting up Mail.app to use a local mailbox. Unfortunately, Mail.app in Leopard only has POP, IMAP and Exchange as mailbox options.

It turns out, though, that things are actually very simple in Leopard. If you want to read local mail in Mail.app, just drop a .forward file in your home directory that contains an external e-mail address as the first (and only) line. It may take a couple of hours for mail to be delivered, but it will eventually get forwarded to your external account. (If there are security reasons why you wouldn’t want to do this, then I guess you’ll need to install an IMAP server on your machine).

The one gem I did glean from the older posts was about the .forward file in /var/root. It contains /dev/null by default, so you won’t see any e-mails sent to the local root user. Replace /dev/null with your local user name and all root e-mails will be forwarded to your local user. And if you have all local e-mails forwarding externally, then you’re set: all root e-mails will end up in Mail.app.

Yet Another Programming Blog

Where James Gordon rambles about PHP, Laravel and web development in general.

Find me on Google Plus Find me on Twitter Find me on Stack Exchange Find me on Github Subscribe