I have the following AppleScript triggered by a Mail.app rule:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
repeat with msg in theMessages
set theText to subject of msg & return & content of msg & date sent of msg
display dialog (theText)
end repeat
end perform mail action with messages
end using terms from
If I select a message, right click and choose 'Apply Rules' it works properly. However, if the script is triggered by an incoming message, it seems to have a random message in theMessages.
How do I get the right message?
I'm using High Sierra with Mail 11.2.