Importing mail with Applescript/"Add to DevonThink" bundle

Hi all,

I’m working on my own Applescript for email import, based on the scripts that come with DT.

I’m noticing that while the “Add to DevonThink” Apple Mail bundle will at least attempt to combine emails by conversation thread the Applescripts don’t. Is there a way to emulate/trigger the conversation thread feature in Applescript?


AFAIK, that’s not possible with the current AppleScript definitions in DEVONthink. The plugin does not use AppleScript technology.

Could you explain more on what you’re trying to accomplish that the plugin and/or provided AppleScirpts does not do for you? Maybe there’s another approach.

Hi korm,

I am trying to achieve the following:

  1. archive complete email conversations

  2. set the email conversation group name to the beginning date and subject

  3. change the DT email object name to prepend a date/time stamp

  4. if an email has attachments, create a folder inside the conversation container instead that contains the email and all attachments

  5. (bonus) remove the email attachments from the archived email and replace it with links to the DT item for each separately archived attachment

  6. (bonus) when selecting emails for import I currently can’t just use the standard Apple Mail conversation view and select the conversation as a whole. This will show me my replies from the Sent folder, but those are not part of the selection seen inside the Applescript. I have to use the email search inside Apple Mail to search for the mail subject and then select all applicable matches to include my replies from the Sent folder, which is really annoying. I’d like to automate that part, too, so I don’t have to go through the search.

  7. is done by the Apple Mail bundle, not very reliably, though.

  8. I can figure out in Applescript

  9. I can figure out in Applescript

  10. I can figure out in Applescript

  11. I haven’t looked for examples yet.

  12. I haven’t looked for examples yet, that’s an Apple Mail scripting issue and not a DT scripting issue.