You could use this script:
However, this requires at least DEVONthink Pro 3 and in case of lots of messages might run for a while.