Remove Duplicate Messages removes duplicate messages from the current selection in Apple Mail. The script determines whether a message is a duplicate of another message by examining these message headers:
If these message headers match another message in the view, the script flags the message as a duplicate and removes it from Mail.
The script displays interactive dialog boxes that allow you to specify whether you want duplicate messages to be removed or retained, optionally prompting you for each duplicate message it encounters while scanning. You can also instruct the script to save all duplicate messages to an archive folder on disk before they are removed.
This script is provided with source code so that you may edit the script as you see fit. Read the included instructions for more information.