Growl notification for your regular mail account

This installation enables you to receive Growl notifications whenever you get a new mail.
The basis is from this tip: http://www.macosxhints.com/article.php?story=20020422082604587
You must read that hint!
And you must use the fetchmailconf in order to set up fetchmail, and expect to fumble a little bit
in order to get everything right. The thing is that you have to explore the interface of
fetchmailconf to understand how it works. I managed , so will you!

I found out that the script and everything worked. I have not set root ownership on the script
nor on the propertylist file.
my version of the checkmail.sh script is as follows: I reworked it a little bit in order to
make the “here” document work properly. Beware: you have to keep your inbox clean fetchmail works
by checking (at least for an IMAP account) wether your inbox is empty or not. :wink:

#!/bin/bash

check if there’s a network connection; mailchecking doesn’t make

much sense without network connection

ok=/sbin/ping -c 1 -q 192.168.0.1 | /usr/bin/grep -c 100% >/dev/console; 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 -Al | /usr/bin/grep Mail.app | /usr/bin/grep -vc grep >/dev/console; ko=0
if test $ok = $ko; then

check if there’s new mail; if there is: start Mail.app

ok=/usr/bin/fetchmail -c -u YOURACCOUNTNAME | /usr/bin/grep -c message>/dev/console ; ko=0
if test $ok = $ko; then
exit
fi
else
exit
fi
else
exit
fi
/usr/bin/osascript <<-EOF 2>/dev/null 1>&2
tell application “GrowlHelperApp”
try
set the allNotificationsList to ¬
{“Mail Notification”}
set the enabledNotificationsList to ¬
{“Mail Notification”}
register as application ¬
“Growls Mail Notification” all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application “Mail.app”
notify with name ¬
“Mail Notification” title ¬
“Mail Notification” description ¬
“You got mail!” application name “Growls Mail Notification” icon of application “Mail.app”
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {“Cancel”} default button 1
end try

end tell

EOF

Enjoy!

McUsr