Is there a Mail rule that can change the background color of an email on read?

I need to highlight emails from one particular customer (red background) - I've done this by using a Rule. It works perfectly, except that once it's been read, I need that background colour to change to grey.

There's no "if mail is read" option. Does this have to be a manual thing?


[Re-Titled by Moderator]

Mac mini, 13.4

Posted on Oct 3, 2023 1:32 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 4, 2023 1:21 PM

Mail rules operate on in-bound emails, not on read emails. You would need to write an AppleScript that post-processes your read email, checks the read status of each email, and then sets the read message background color to gray.


In the Mail AppleScript dictionary, there is a message read status property with a boolean value so for a given message, you can get true or false on its read status and there is another property named background color where gray is among the named color options.


This will change the background of the message in the list of messages, but not the background of the message body.


Copy the following AppleScript into Apple's Script Editor (e.g. Dock : Launchpad : Other : Script Editor), click the hammer icon to compile it. Select an email message that you have read, and then click run in the Script Editor.


(*
gray_msg.applescript

set the message (not the message body) background to gray after you
have read the message. This code currently only operates on one
selected read message.
 *)

use scripting additions

tell application "Mail"
	if it is not running then activate
	
	if not (get selection) is {} then
		set theMsg to item 1 of (get selection)
	else
		return
	end if
	
	tell theMsg
		if its read status then
			set its background color to gray
		end if
	end tell
end tell
return



Select any email message where you have read it, and want its background set to gray.

Similar questions

2 replies
Question marked as Top-ranking reply

Oct 4, 2023 1:21 PM in response to kev265

Mail rules operate on in-bound emails, not on read emails. You would need to write an AppleScript that post-processes your read email, checks the read status of each email, and then sets the read message background color to gray.


In the Mail AppleScript dictionary, there is a message read status property with a boolean value so for a given message, you can get true or false on its read status and there is another property named background color where gray is among the named color options.


This will change the background of the message in the list of messages, but not the background of the message body.


Copy the following AppleScript into Apple's Script Editor (e.g. Dock : Launchpad : Other : Script Editor), click the hammer icon to compile it. Select an email message that you have read, and then click run in the Script Editor.


(*
gray_msg.applescript

set the message (not the message body) background to gray after you
have read the message. This code currently only operates on one
selected read message.
 *)

use scripting additions

tell application "Mail"
	if it is not running then activate
	
	if not (get selection) is {} then
		set theMsg to item 1 of (get selection)
	else
		return
	end if
	
	tell theMsg
		if its read status then
			set its background color to gray
		end if
	end tell
end tell
return



Select any email message where you have read it, and want its background set to gray.

Oct 4, 2023 1:22 PM in response to kev265

kev265 wrote:

I need to highlight emails from one particular customer (red background) - I've done this by using a Rule. It works perfectly, except that once it's been read, I need that background colour to change to grey.
There's no "if mail is read" option. Does this have to be a manual thing?

[Re-Titled by Moderator]


there maybe some possibilities, never saw color options however what you are asking...


see what is here

ref: Color-code emails in Mail on Mac - Apple Support



you can add—Mail>View>Customize Toolbar:




ref: View email conversations in Mail on Mac




you can submit your Apple Feedback here: Feedback - Mail - Apple





This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is there a Mail rule that can change the background color of an email on read?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.