Smart Groups and Attachments


I’m using DevonThink to assemble documents to defend myself in a lawsuit. For this I need several items.

One thing is that I need to group all mails with attachments from a specific e-mail address. However, I don’t see where in the Smart Group I am able to determine whether an e-mail has an attachment.

Secondly, I need a way to display all headers of the e-mail and print them too. I’m not sure how to go about doing that or if DevonThink actually has all the headers available to it?

Thanks in advance for our help. This is, for obvious reasons, extremely important to me.



If you are going to be using the emails in a lawsuit then at some point they are going to have to be in PDF format for printing. The best way to manage your task is to first convert your emails to PDF prior to pulling them into DT.

My goto tool for doing this is Email archiver It will take a folder of email from Mail (or Outlook too now I believe), and produce a neat hierarchy of files and folder where the body of the email is converted to pdf (including headers) and named with a unique identifier. The attachments are in a separate directory bearing the same name as the email. When the email body is converted to pdf the quicklook preview of each of the attachments is also included in the pdf.

I use automator scripts to traverse Email archiver’s directory tree and convert common formats, such as word and text document and images into pdfs. Its also easy to do this manually.

DT can import the whole of the directory tree produced by Email archiver. After the directory tree is imported into DT, its a matter of working through the directories and pruning them for irrelevant attachments and converting the attachments into pdfs. There are scripts in this forum which make that task easier. I replicate the emails and attachment to be discovered into a separate single directory so I don’t interfere with the original directory tree in case I have to refer to them later for reference.

Its also easy to set up a smart group to match emails from a particular address based on the standardised way Email archiver prints the email headers onto the pdf. Long experience has taught me however that doing these kind of exercises manually, examining each document and doing a qualitative analysis of the relevance of the document for inclusion in discovery is far preferably to relying on automatic sorts.

Once you have a single folder with all the emails and attachments, they can be arranged in a suitable order (either by automatic sort on the columns or by making the sort order ‘unsorted’ and sorting manually) and one of the scripts on this forum can be used to produce an index. Further down the line you may also want to Bates number the documents in the folder depending on the requirements of your jurisdiction.

Even if you don’t want to use an attorney (on the wisdom of which I shall make no comment) you should definitely get professional advice on the applicable rules for your jurisdiction on the production of documents. Not following the rules means your documents could easily be excluded.


FWIW, Dave, some very good advice here ^^ from Frederiko, particularly the bit about confirming procedure regarding documentary evidence. And discovery thereof…

Unless you’re proceeding in a small claims court, or something similar, where rules etc. are less formal (and more flexible) - no point in going through all of this effort, if the end-result is that the Court rules it to be inadmissible from the get-go…

OR, you go and set everything up, only for it all to have to change, to comply with whatever the Rules require…

Regardless, good luck.

Thank you for the advice. I will buy the program you described because it is far preferable to converting things manually.

However, the problem is that I have 70K plus e-mails through which I must search.

Getting them into DTPO is difficult because of the import ‘blocking’, yet I’ve dedicated a machine to this and then move the database to the actual machine that I use.

The real problem is that once I get things together, I do need some assistance from the searching features to whittle down the sheer number of mails to those that I will then manually review to determine if they are useful for my defense.

Honestly, it would be very nice to have a DTPO import that would fill in the basic information such as you would find in a Finder item and then, in a separate thread, scan and fill in the information in the background. I do know thats unlikely to happen in the time frame that I need.

So, with that said, I would love to hear any other tips that could help me in this situation. Even if they are unrelated to DTPO. I’ve never gone through this before and I’m finding it very daunting. And, unfortunately, it is not small claims: Its pretty much a corporate implosion. :frowning:


Actually, its 120,846 e-mails.

Why not do a bit of a prefiltering search in first, then process and add to DEVONthink?

You may find Smart Mailboxes useful for this so you don’t lose track of items with a simple search (in the upper righthand searchField).


… and filter some more…When you search with the searchField you can specify a Smart Mailbox to search. Note: you don’t have to save another Smart Mailbox. I was just showing that you could if needed.

This way you don’t have to try and import everything up front.

Good luck!


Unfortunately, not all of my mail is in Apple mail. Indeed, much of it is in old Outlook files. Further, I have old The Bat mails, Outlook Express Mails, etc. Thank goodness Emailchemy will happily export them all to the format of my choice.

So, my questions are still valid. I’m beginning to think that there isn’t anything I may do in DTPO to ensure that the headers are printed along with the contents of the e-mail. Nor will I be able to use the existence of an attachment in a smart mailbox filter.

To add insult to injury, i must also convert Microsoft MDI format to TIF and then to PDF.

I agree with Bluefrog wholeheartedly that you should do your prefiltering in the email client and flag the emails you want to convert. There are just so many reasons why this is the correct way for you. Email clients are designed to handle email very efficiently and even Mail can create smart folders. DT’s email handling should only be a last resort. I think you are trying to do something in DT which is not its forte.

You might also want to look at other email clients:
Mailmate: Has incredibly powerful search tools especially when it comes to email headers. Its probably the geekiest of email clients so approach with caution.
Postbox: Has very powerful search folders. It also has the invaluable facility, which I have never found on any other Mac email client, to show a list of all the attachments to all the email that match the search criteria. This can be invaluable for tracking versions of attachments.

I used to use Scrivener for the tasks I use DT for now. Scrivener has user definable metadata so I was able to use do some Python Scripting to extract the email header information from an emailarchiver pdf tree and put in the metadata. With Scrivener’s outline view it was very easy then to have a view such as: To; From; CC; Subject; Date etc. After that it was trivial to sort by column, date etc. or to create collections (Scrivener’s equivalent of smart groups). This seems to be actually what you are trying to do. Ultimately I moved to DT because Scrivener’s engine was not designed as a fully fledged database and after 5000 docs Scrivener turned to molasses.

The only way you can do a similar task in DT would be to script an index page with the To: From: CC: Subject etc and include a DT link to the document, and the attachments folder, as columns. After that you export the index to a spreadsheet to sort and filter. The DT link at least means you can go directly from your spreadsheet to the document. Honestly this is some pretty advanced scripting. I need to do it for myself but haven’t had the time :frowning:

DT getting user definable metadata would elevate things to another level. When this gets to the top of what I am sure is Christian’s very long todo list, then I will be happy and I can rework my hundreds of lines of python code from being autonomous to integrating with DT.

PS Emailchemy is a fantastic tool tool. I would be lost without it.


Thanks for all the help. I am still stuck in some areas because there simply isn’t a way for me to filter the mails since I no longer have the actual programs in which the mails were created.

That being said, I am hopeful that I currently have far more than is necessary to meet my needs in this respect.

Thank you all