Set Background Color of Selected Messages in Apple Mail

I am trying to find a script to set the color of the message to a given color.

tell application "Mail"
	activate
	set the_message to item 1 of (get selection)
	tell the_message
		
		set color message to {0, 32896, 16448}
		
	end tell
end tell

does not work. Would anyone have an idea of rectifying this ?

Hi dysong3,

If you want to set the color of a selected message, you can use code as follows. But please note, that it seems to me that you cannot use a custom color, only the given range of blue/gray/green/none/orange/other/purple/red/yellow, as mentioned in Apple Mail’s AppleScript dictionary (whatever «other» means…).


tell application "Mail"
	set msg to item 1 of (selection as list)
	set background color of msg to blue
end tell

On a related topic, is it possible to set the background color of mail in the GUI (for me to see) without adding it to the mails themselves?