Applescript to delete incorrectly sent emails

Joined
Jun 2, 2022
Messages
1
Reaction score
0
At occasional random times (many months apart), Microsoft Exchange has severe indigestion and regurgitates large numbers of emails that I dealt with long ago. I am currently faced with hundreds of duplicated and obsolete emails. I would like to write an Apple Mail filter that deletes these. I have read that Mail will accept filter rules in Applescript. The date that the email was first delivered to Microsoft Exchange does appear with Mail>View>Message>All Headers, so this appears to be a possible route to sanity. However the Mail search facility does not appear to search these Headers. If you don't ask for All Headers, the email contains no hint of its age. Any ideas/help?

I have only ever written one Applescript (which I use many times a day), but that was years ago, and I have forgotten what little I once knew.
In order to preserve Mail's indexes, I need any deletion to be done by Mail. (I could probably manage on my own if I could do the job using only bash.)
 

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,105
Reaction score
497
Hello and welcome.

Sorry for the delayed response.

I am not very experienced with AppleScript/Automator either. Maybe another member will chime in, or you could try the folks over at MacScripter.

C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top