quicksilver/creations/applescript_mail.app_new_mail_notification.txt · Last modified: 2006/03/31 03:53 by 58.143.155.56


About

Uses Quicksilver to notify you of new mail in Mail.app.

Usage

Save the script using Script Editor and open Mail.app's preferences. Choose the Rules pane. Add a rule that reads like this: For every message received run the AppleScript saved from Script Editor.

Once the rule is set up Mail.app will call this script for every new message received and Quicksilver will display the sender and subject.

Known Issues

  • Mail.app seems to call this script on some emails before it checks whether or not they are junk, thus preventing the script from filtering junk properly

Source Code

on perform_mail_action(info)
  tell application "Mail"
    set selectedMessages to |SelectedMessages| of info
    repeat with eachMessage in selectedMessages
      set theSubject to subject of eachMessage
      set theSender to sender of eachMessage
      if ((junk mail status of eachMessage is not true) and (subject of eachMessage does not contain "[```**SPAM**```]")) then
        tell application "Quicksilver"
          show notification theSender text theSubject image "com.apple.mail"
        end tell
      end if
    end repeat
  end tell
end perform_mail_action

Credits

Written by Brian Donovan with help from the forums.

Disclaimer

This add-on may be freely distributed. It is not guaranteed to work (though it has been extensively tested), and you use it at your own risk. Post suggestions in the forums.