Delete spammy emails from Trash

In SpamSieve 3.0.1 I had mistakenly set up SpamSieve so that spammy emails were being sent to Trash rather than Junk. Is there some Apple Mail rule or other process whereby I can delete those emails from Trash?

You can just choose Mailbox ‣ Erase Deleted Items in Apple Mail to empty the trash. Or am I misunderstanding your question? Are you trying to have other non-spam messages remain in the trash?

Here is a small sample of what is in my Trash and I’d like to delete just the colored ones. I could do it manually but there are at least 100 of them.

Apple Mail no longer has a way to sort/search by color. You could move the messages out of the Trash and re-apply SpamSieve to all of them (using Filter Messages), but that might not be desirable or necessarily exclude the ones that are not currently colored.

What I would do is select all the messages in Trash and then run this AppleScript:

tell application "Mail"
    set _messages to selected messages of message viewer 1
    repeat with _message in _messages
        if _message's background color is not none then
            set _message's flag index to 6 -- gray
        end if
    end repeat
end tell

You can copy/paste it into a window in the Script Editor app and then click Run. This will mark only the colored messages with a flag. Then you can use Mail’s View ‣ Filter ‣ Flagged command to show only the flagged messages. It would then be easy to delete them all at once.

You’re probably wondering why I don’t just have the script itself delete the messages. You could try that, but my experience is that deleting messages via AppleScript has been buggy for some years now.

Thanks.