Has Mail's passing of messages to an AppleScript changed in ML?

For a number of years, I’ve been using an AppleScript to fire off a Growl notification when I receive a message in Mail from certain senders. Although it’s very similar to a script provided at Growl.info for the very same thing, I’m finding that it’s not working properly since I upgraded to Mountain Lion. The Mail rule that runs the AppleScript is very simple: a list of (any) conditions with a single Run AppleScript action.

AFAIK, this rule should only pass to the AppleScript those messages that match the conditions (some “Subject contains”, some “From contains”). However, I’m getting Growl notifications of messages that arrive at the same time as messages that should match the rule. For example, I get two messages in, one of which has a sender of “johnsmith@example.com” and another from “marysue@domain.net”, and I get notified of the John Smith message when it’s Mary Sue who is in the Mail rule. (I don’t get notified of the Mary Sue message.)

Here’s the AppleScript:


using terms from application "Mail"
          on perform mail action with messages theMessages for rule theRule
                    tell application "Mail"
                              repeat with eachMessage in theMessages
                                        set theSubject to subject of eachMessage
                                        set theSender to sender of eachMessage
                                        set theMessage to "You have received a message from " & theSender & "."
 
                                        tell application "Growl"
                                                  set theName to "New Message"
                                                  set theAppName to "Custom Mail Notifications"
                                                  set the allNotificationsList to {theName}
                                                  set the enabledNotificationsList to {theName}
                                                  register as application theAppName ¬
                                                        all notifications allNotificationsList ¬
                                                        default notifications enabledNotificationsList ¬
                                                        icon of application "Mail.app"
                                                  notify with name theName ¬       
                                                        title theSubject ¬
                                                        description theMessage ¬
                                                        application name theAppName ¬
                                                            with sticky
                                        end tell
                              end repeat
                    end tell
          end perform mail action with messages
end using terms from

I don’t believe the problem is in the script, since theMessages shouldn’t include the John Smith message, but I don’t have any other explantion. Could someone else hazard a guess at what is going on here? Thanks!

Hi mrtoner,

That’s really weird. Those addresses look like defaults. Is that from Mail?

gl,

The addresses johnsmith@example.com and marysue@domain.net are two fictitious addresses I used as an example.

Don’t mind me I’m cracking up about myself if you know what I mean.