Read crontab output in Mail.app
Nov 15, '04 09:32:00AM
Contributed by: Anonymous
This hint allows you to read any messages from the Terminal's mail in Mail.app. This includes crontab output, and local UNIX mail. In Mail.app, do this:
- Create a new folder and name it what ever you want, with the Location as "On My Mac."
- Now select any message in Mail.app, and copy it to the newly created folder (Control-Click it, and select "Copy To" and then select the newly created folder) -- otherwise, Mail.app will not create a file named mbox.
- Quit Mail.app
In the Terminal, type the following commands, hitting Return after each:
- chmod 1777 /var/mail
- rm /var/mail/username -- This will delete the old UNIX mail file if it exists. If it returns No such file or directory, it's not a problem.
- sudo ln -s "/Users/username/Library/Mail/Mailboxes/mailbox.mbox/mbox" /var/mail/username -- username is the name of your Home folder (all lowercase), and mailbox.mbox is the name of the newly created mailbox in Mail.app -- case matters, and it must have the .mbox extension.
This works both ways, so that when you type mail in the Terminal, you'll see any messages listed within the created Mail.app folder. Unfortunately, Mail.app will not update the folder on its own, so you'll have to select the folder to see if there're any new messages (but I'm sure an AppleScript could be setup to do that).
Comments (5)
Mac OS X Hints
http://hints.macworld.com/article.php?story=2004111223552833