Mail doesn't pass correct messages

I have for some time been using a rule in Mail to run an AppleScript to inform me of messages from specific senders. The script triggers a Growl notification. However, the workflow is not flawless and I’m not sure if the problem is with Mail (as I suspect) or with my script. Here’s the script:

using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		tell application "Mail"
			set myTag to "GrowlMessage"
			do shell script "logger -t " & myTag & " received " & (count of theMessages) & " messages."
			repeat with eachMessage in theMessages
				set theSubject to subject of eachMessage
				set theSender to extract name from sender of eachMessage
				set theMessage to "You have received a message from " & theSender & "."
				set myMessage to "Subject is " & theSubject & ", Sender is " & theSender
				set myTag to "GrowlMessage"
				do shell script "logger -t " & myTag & " " & myMessage
				tell application "Growl"
					set theName to "New Message"
					set theAppName to "Custom Mail Notifications"
					set the allNotificationsList to {theName}
					set the enabledNotificationsList to {theName}
					(* Only needed the first time the script is run *)
					register as application theAppName ¬
						all notifications allNotificationsList ¬
						default notifications enabledNotificationsList ¬
						icon of application ""
					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

More often than I would like, I receive a notification that I’ve received a message from a sender who is not specified in the Mail rule. I’ve added some debugging code to the script, so that I can see what’s happening. Here’s what Console shows today after I received several messages from Work Market, which is what the rule is looking for (Sender is

7/22/15 9:28:22.562 AM GrowlMessage[9140]: received 2 messages.
7/22/15 9:28:22.666 AM GrowlMessage[9141]: Subject is Assignment updated: No Boot, PC not turning On, Freezes at startup or any other Boot Related Problem, Sender is Work Market

7/22/15 12:12:37.268 PM GrowlMessage[18201]: received 3 messages.
7/22/15 12:12:40.203 PM GrowlMessage[18203]: Subject is Webiste, Sender is TWH
7/22/15 12:12:43.020 PM GrowlMessage[18205]: Subject is The value of a Twitter follower, Sender is Twitter for Business

7/22/15 12:19:00.713 PM GrowlMessage[18607]: received 1 messages.
7/22/15 12:19:02.737 PM GrowlMessage[18609]: Subject is Assignment updated: 905100 Swap out Keypad on 2 time clocks, Sender is Work Market

7/22/15 1:24:13.343 PM GrowlMessage[22263]: received 1 messages.

7/22/15 1:29:56.004 PM GrowlMessage[22580]: received 1 messages.
7/22/15 1:29:57.970 PM GrowlMessage[22581]: Subject is Concert Technologies has Work for You!, Sender is Concert Technologies via Work Market

I broke those lines up for readability; what I’m seeing is this:

  • The script says Mail passed along two messages at 9:28, but there is only one listed
  • The script says Mail passed along three messages at 12:12, but there are only two listed
  • The 12:12 messages do not include a message from Work Market
  • The 1:24 message (which was from WM) is not listed

My questions are these:

  • Is there an error in my script?
  • Why does Mail pass multiple messages to the script instead of a single message that matches the rule?
  • Why does Mail pass any messages at all that don’t match the rule?
  • Why are some messages missing (the count doesn’t match the messages listed)?
  • Is there a better way to do this?

I’d be grateful for any help you folks can provide.

AppleScript: 2.4
Browser: Safari 600.7.12
Operating System: Mac OS X (10.10)