How to select message in Mail with ID using AppleScript?
Probably not the only way to do it... And these are not my favourite type of scripts.

But here is an example of each of the syntax you describe.

Look up:


message viewer
selected mailboxes
selected messages


In the  Applescript library for Mail.

tell application "Mail"
    set theMailID to 543521
    set theM to mailbox "INBOX" of account "iCloud"

    set selected mailboxes of message viewer 1 to theM
    set sort column of message viewer 1 to from column
    delay 0.5 -- important delay or message selection may not happen
    set selected messages of message viewer 1 to (first message of (theM) whose id = theMailID)

end tell