Mail Rules: Cannot access messages in list

I have a Mail rule activated by certain text in the Subject with an action for Run Applescript (with a script like below). I’ve tried every permutation I can think of but can never access any of the properties of a message. It must throw some kind of error (that I cannot debug) as the second alert never displays.

My search seems to indicate this might be a bug in Mountain Lion, but it would seem to me this is a key command and I’m just doing something wrong.

Any help would be appreciated. Thanks!


using terms from application "Mail"
	on perform mail action with messages theMessages for rule aRule
	
		tell application "Mail"
			
			-- always displays the correct number of messages when the rule is applied
			display alert "Number of Messages in List" message count theMessages
			
			-- this should work, right?
			set firstMessage to item 1 of theMessages
			
			-- but this never appears
			display alert "The Message" message (content of firstMessage)
			
		end tell -- Mail 
		
	end perform mail action with messages
end using terms from

Model: iMac
Browser: Safari 536.29.13
Operating System: Mac OS X (10.8)

Well, I got something like this to work (but it was after I quit and restarted Mail - whether that did it or not, I don’t know)


using terms from application "Mail"
	on perform mail action with messages theListOfEmails for rule aRule
		
		tell application "Mail"

			repeat with thisEmail in theListOfEmails
				
				set theContent to content of thisEmail as rich text
				
			end repeat
			
		end tell -- Mail 
		
	end perform mail action with messages
end using terms from