Read Apple Mail current thread

Is it possible to read the current thread email using Applescript? Here is an example what I mean Screenshot uploaded to CleanShot Cloud

What do you mean by ‘read’?

I mean able to retrieve all the messages from the current thread.

You should be able to select a message and then get its contents. Those contents should include whatever exists in the selected message including previous replies.

If you are thinking of stitching together multiple messages that have the same subject, you should be able to do that as well but obviously, it would be more complex.

Try the following.
It’s using the selected message of the frontmost window (⌘⌥N) as a reference.

tell application "Mail"
	if not (exists message viewer 1) then return beep
	set theRef to (selected messages of message viewer 1)
	set {theSender, theSubject} to {sender, subject} of first item of theRef
	if theSubject starts with "Re: " or theSubject starts with "Réf : " then
		set AppleScript's text item delimiters to {"Re: ", "Réf : "}
		set theSubject to last text item of theSubject
	end if
	set theThread to messages of message viewer 1 where all headers contains theSender and all headers contains theSubject
end tell