Apple Mail Rule Script help

Hi!
Please help me with an apple script to do the following in Mail and Rules.
A Mac Big Sur Mail which COPIES a mail to another folder but upon copying, mark the copied mail as read whilst leaving the original in its mailbox as unread? How can I do that?

Point is, I have a work mail which’s copy I need to keep under my private mails:
So the work mail is in folder A of the incoming inbox.
When it arrives, I have configured a copy to be automatically copied to mailbox B under my private email. Everything works well.

Now, under the Mac Mail rule, I have additionally selected the copied mail to be marked as unread. This does not work. It marks both the A and the B as unread.

Now I need a script which does the following:
Upon copying the newly arriving mail to B, mark the B as read leaving the A still as unread.

Please help.
Thanks for a swift response.
Thanks

Not sure of this is still a requirement or not, but I took a look at it. Turns out to be harder than expected.

It should be trivial - duplicate the message and set the read status flag, but it’s not that simple.

Usually the duplicate command returns a reference to the new object, but not so in Mail.app’s case (get on this, Apple).
Next, the duplicate command does have a with properties option which should let you change the message’s read status, but this doesn’t work (again, Apple).

So the best I could come up with is to duplicate the message, then scan the target folder for ‘unread’ messages and change them to read:

use AppleScript version “2.4” – Yosemite (10.10) or later
use scripting additions

using terms from application “Mail”
on perform mail action with messages messageList in mailboxes mbox for rule aRule

	repeat with each_message in messageList
		duplicate each_message to mailbox "My Mailbox Name"
	end repeat
	set read status of (every message of mailbox "My Mailbox Name" whose read status is false) to true
	
end perform mail action with messages

end using terms from

You could also try changing the last line to

set the read status of every message in mailbox "My Mailbox name" to true

It might be faster with large mailboxes if it doesn’t have to read a property for each message. Also, according to the scripting dictionary for Mail, you shouldn’t need a loop, and instead should be able to:

duplicate the messageList to mailbox "My Mailbox name"