Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Read crontab output in Mail.app UNIX
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:
  1. Create a new folder and name it what ever you want, with the Location as "On My Mac."
  2. 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.
  3. Quit Mail.app
In the Terminal, type the following commands, hitting Return after each:
  1. chmod 1777 /var/mail
  2. 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.
  3. 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).
    •    
  • Currently 1.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[10,459 views]  

Read crontab output in Mail.app | 5 comments | Create New Account
Click here to return to the 'Read crontab output in Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Read crontab output in Mail.app
Authored by: oliverbock on Nov 15, '04 03:31:16PM
Alternatively, enable Postfix and have it deliver the messages to your normal mail account, along with any other messages generated by the system and other UNIX programs.

(You will need to modify /etc/aliases to redirect your mail to an external account.)

[ Reply to This | # ]

Read crontab output in Mail.app
Authored by: tjj on Nov 15, '04 05:09:10PM

Any security concerns with chmod'ing /var/mail/ to 1777?The default bits are -rw------- (600?) with myUserName as User and mail as group.



[ Reply to This | # ]
Read crontab output in Mail.app
Authored by: cilly on Nov 15, '04 06:08:49PM

Repair permissions will set /var/mail/ to:

drwxrwxrwx

It is more secure to use:

drwxrwxrwt

on the directory.

The files inside this directory match:

-rw-------

which is okay.

---
cilly @ http://www.cilly.dyndns.org



[ Reply to This | # ]
File mode
Authored by: tjj on Nov 16, '04 03:56:14PM

hmm, thanks.
I have /var/mail/ as 775, though. -And that's after repairing permissions on a 10.3.6 installation.

The sticky bit makes the directory append only for other users than the owner of the directory and the files therein.
I guess this has some merit, are there any adverse effects, since it isn't 1777/1775 as default?

I didn't change the file modes, just rm'ed the file /var/mail/MyUser and created the symlink. It works as described in the hint. Mail.app, though, doesn't seem to delete the unix mail. They are still there when accessed from terminal.app.

-Edit. Mail.app does indeed delete the mails, but apparently only after closing the mailbox.



[ Reply to This | # ]
Read crontab output in Mail.app
Authored by: rwmitchell on Nov 15, '04 08:40:36PM

I just posted this same solution in a thread that was started back in March:

http://www.macosxhints.com/comment.php?mode=display&sid=20040313194905606&title=Access+local+mail+via+Mail.app&type=article&order=&pid=48577

The two problems that I have noticed is that:

- you have to click on the mailbox to see it updated ( as the author of this hint also indicated)
- mail that arrive to that mailbox while you have it open, seems to get lost. I could be wrong about that, but it did seem that way.



[ Reply to This | # ]