What I really was missing on OS X so far was a small mailchecker. There are several programs for mail checking, but each one I tried takes almost as much RAM as Mail.app, which I use. So I wrote a little script, run by cron, which checks whether there are new mails (using fetchmail) and fires up Mail.app if there are.
Read the rest of the article for the script and installation instructions.
I'm really not a scripting king, but here it is. For installation you don't need to know much about the command-shell and I'll describe all editing-tasks.
First, create the following script in your preferred UNIX text editor:
#!/bin/shEdit the file with the following steps:
# check if there's a network connection; mailchecking doesn't make
# much sense without network connection
ok=`/sbin/ping -c 1 -q 17.254.0.91 | /usr/bin/grep -c 100%` ; ko=0
if test $ok = $ko; then
# check if Mail.app is already running; we needn't check mail
# nor do we need to start Mail.app in that case
ok=`/bin/ps -aux | /usr/bin/grep Mail.app | /usr/bin/grep -vc grep` ; ko=0
if test $ok = $ko; then
# check if there's new mail; if there is: start Mail.app
ok=`/usr/bin/fetchmail -c | /usr/bin/grep -c message` ; ko=0
if test $ok = $ko; then
exit
else # !!adapt the path and the mail-client in the following line!!
/Applications/Mail.app/Contents/MacOS/Mail &
fi
fi
fi
server your.popserver.name # Change to your mail servernameNOTE: The space at the beginning of all lines after the first is important! Change the file permissions on .fetchmailrc in the Terminal with chmod 0710 .fetchmailrc, and set the owner of the script to root with sudo chown root .fetchmailrc.
protocol POP3 # Change to your mail protocol
username MAILUSER # Change MAILUSER to your user's mailserver name
password MAILPWORD # Set MAILPWORD to the corresponding password
fetchall
keep
noflush
mda "/usr/libexec/mail.local USER" # Change USER to your OS X username
*/1 * * * * USER sh /Users/USER/bin/MailCheck.shHere you have to change "USER" to your (tada!) OS X user name, and adapt the path to reflect the location where you saved MailCheck.sh. If want to have mails checked just every five minutes, change "*/1" to "*/5". If you're not familiar with cron, try CronniX, an OS X gui for cron.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20020422082604587