Applescript to set the flagged status of emails in the trash (Apple Mail)
Hello,
I'm trying to write an AppleScript that sets the flagged status of an email in the Trash from true to false. But the script cannot find the emails that have a flagged status of true in the Trash. If I change the mailbox to "INBOX" the script will find flagged emails in the Inbox and set the flagged emails to false removing the flag. Not sure what I'm doing wrong. Can anybody help? My script is below. Thanks.
tell application "Mail"
repeat with _account in imap accounts
set _inbox to _account's mailbox "Trash"
set _messages to (a reference to (every message of _inbox whose flagged status is true))
set _msglist to contents of _messages
repeat with _message in _msglist
--try
set flagged status of _message to false
--end try
end repeat
end repeat
end tell
MacBook Pro 15″, macOS 11.0