Mail and label color

I am trying to write a script what check’s my mailbox, and if the color of the message is orange he will do certain thinks with it. So i can color a message easy and the script will make a new folder on the server with the name of the subject of the mail, and with 2 subfolders in it, 1x for the attachment and 1x for the bodytekst of the mail.
To start i wrote this :

tell application "Mail"
	set everyMailBox to every mailbox
	repeat with singleMailBox in everyMailBox
		set everyMessage to every message of singleMailBox
		repeat with singleMessage in everyMessage
			tell singleMessage
				if background color is orange then
					display dialog "Yep! Script works!!"
				end if
			end tell
		end repeat
	end repeat
end tell

But this give an error (NSInternalScriptError) on the line: “if background color is orange then”
Anyone knows what i do wrong or has a better solution to solve this problem ?

Hi Jan,

unfortunately it’s not possible to read the background color of a message,
I regard this as a bug.

Hi Stefan,

I was afraid of that ! Thanks for your responce, knowing that’s not my own stupidity but a bug from Mac makes me feel better :wink: