Filtering mail via the attachment method

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

Reader Jesse Pazmino would like some assistance filtering attachment-bearing email in Apple’s Mail. He writes:

I use Apple’s Mail. I have a friend who constantly sends e-mails that are either only text-based or exclusively include attachments. Since I only like printing out the text based messages I wanted to find a way to sort out only those that are text and leave out all of the others that have attachments. This would save me a lot of time that I would otherwise spend going through my entire mailbox figuring out which one has attachments and which one doesn’t. Although I did create a smart folder to only take those with attachments I can’t seem to create one that only has the text based messages of the sender. Is there any way I could do that?

Thanks for the question, Jesse. I offer this rare thanks not only because your question provides fodder for this blog (and, possibly, the Mac 911 column), but also because it gives me the opportunity to publicly whine, yet again, about Mail’s weak rules. Specifically, please, please, please, pretty please Apple, could you add an Attachment Exists condition to the next version of Mail’s Rules? Entourage has it, why not Mail?

Okay, enough whining. The trick to making Mail filter messages in more exacting ways is to delve into email messages’ headers and locate unique headers that can then be used to separate the good from the not-so. In this case, I’d suggest this:

Launch Mail, go to Preferences > Rules and from the pop-up menu that appears in the If portion of the Rules window choose Edit Header List (it’s at the very bottom of the list). Click the Plus (+) button at the bottom of the resulting Message Headers windows, type Content-Type, and click OK.

Select a typical text message (one without attachments) from your friend and press Shift-Command-H to show the message’s long headers. Scan down until you find the Content-Type entry and note what it says— text/plain, for example.

Create a new mailbox for this person’s messages by pressing the Plus (+) button at the bottom left corner of the main Mail window.

Now create a new rule that reads:

Sender is yourfriend’semailaddress (which is, of course, your friend’s email address)

Content-Type Contains text/plain (or whatever happens to appear next to the content-Type entry in his or her messages’ long header).

Configure the rule so it says If All of the following conditions are met.

Finally, have the rule move any messages that meet these conditions to the mailbox you created for your friend’s messages.

This should move only text messages from this sender.

If you’d like to tackle it from the other direction, look for messages from your favorite sender that contain attachments. Content-Type will contain something like multipart/related or multipart/alternative .

This seeking attachments technique is also useful for weeding out certain kinds of spam. For instance, I’ve created a rule that looks for Content-Type contains multipart/related that is not from contacts in my address book. It’s done a great job of spotting new varieties of spam that occasionally slip past my other filters.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon