Use pine to read Mail.app mail
Oct 31, '02 09:47:21AM
Contributed by: jalex
Here's how you can download mail using Mail.app and still be able to read it from anywhere. A little background ... I like to use Mail.app when I'm at home, and Mail.app is configured to download all my mail via POP and delete it from the server. When I'm at work, I want to be able to read my mail, so I just use pine to read Mail.app's mail file. This is a pretty easy one. In a shell, just do the following:
% cd ~/mail
% ln -s /Users/user_name/Library/Mail/account_name/INBOX.mbox/mbox
./my_account_inbox
Note: The "ln -s" line is shown on two lines, but needs to be entered as one with a space replacing the line break.
In the above, user_name is your local user name, and account_name is the email account you're getting mail from (if you look in that directory, the names are obvious). The final part, (./my_account_inbox) is what you want the mail folder to be called when pine sees it. Since I use AT&T Broadband's email, I called mine att-inbox.
Anyway, now if you run pine and go to the folder list, you'll see your my_account_inbox right there. As long as Mail.app is running while you're out, it'll keep fetching mail and writing it to your mailbox. pine will notice the changes at regular intervals, or you can hit Ctrl-L while in the index screen to get it to check for anything new. Keep in mind that this just causes pine to check the mailbox file -- it doesn't make Mail check with your mail provider for mail. To do that, you could write an AppleScript that can be run from the command line that causes Mail to wake up and check your email. Run osascript with this: tell application "Mail"
check for new mail
end tell
Any new mail will get pushed into your mailbox file, so it'll be available to pine.
One final note: I've only done this with POP accounts, and it sounds like it may not work with IMAP. Also, this should work with any UNIX mail program that lets you choose an alternate mailbox. If you use a UNIX program that notifies you when you have mail, try setting $MAIL to the path to your mailbox file to make the program find the new mailbox.
Comments (23)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20021031064721177