I am trying to make an email parser in JXA. I was able to do something similar in applescript:
tell application "Mail" to set theMessages to every message of mailbox "Inbox" of account "MyAcount" whose subject is equal to "Search Text"
repeat with aMessage in theMessages
tell application "Mail" to set {mContent, mDate} to {content, date received} of aMessage
......process each mail.....
end repeat
How would I replicate this but in javascript?