Tigerまででは「Mail.appetizer」を使って、新着メールが来たときにその内容をフロートウィンドウに出していたのですが、これがLeopardでは動きません。
代わりの方法として、AppleScriptとGrowlを使う方法が紹介されています。
メールフィルタのルールとしてAppleScriptを入れる方法です。迷惑メールの通知は要らないので削り、ついでにメールの本文も通知できるスクリプトにしてみました。
使い方
- 以下のスクリプトを「スクリプトエディタ」にペースト、「スクリプト」ファイルとして適当な場所に保存。
- スクリプトエディタ内で、一回だけ実行しておく。(Growlに登録するため)
- メールの振り分けルールの一番上で、「全てのメッセージ」に対して「AppleScriptを実行」するようにし、上記ファイルを指定。
- 迷惑メールの設定で「ルールを適用する前に迷惑メールを選別」にチェック
tell application "GrowlHelperApp" set the allNotificationsList to {"Mail"} set the enabledNotificationsList to {"Mail"} register as application "Growl Mail Rule" all notifications allNotificationsList ¬ default notifications enabledNotificationsList ¬ icon of application "Script Editor" end tell using terms from application "Mail" on perform mail action with messages messageList repeat with thisMessage in messageList try if junk mail status of thisMessage is false then set theSender to sender of thisMessage set theSubject to subject of thisMessage set theSummary to paragraphs 1 thru 4 of (content of thisMessage) set tid to AppleScript's text item delimiters set AppleScript's text item delimiters to return set theSummary to theSummary as text set AppleScript's text item delimiters to tid tell application "GrowlHelperApp" to notify with name "Mail" ¬ title "Mail" description ¬ "From: " & theSender & return & return & "Subject: " & theSubject ¬ & return & return & theSummary ¬ application name "Growl Mail Rule" end if on error X tell application "GrowlHelperApp" to notify with name ¬ "Mail" title "Growl Mail Rule Error" description X ¬ application name "Growl Mail Rule" end try end repeat end perform mail action with messages end using terms from
on errorでちゃんとエラー処理をしないと、単に無視されてしまうようで、エラーに気づかず厄介かも。また、display dialogしたりするとMailが固まるようです。