Jump to content
Vero

Mail.app search by author, subject or content

Recommended Posts

Thought I should share this workflow I created earlier to search Mail.app :)

 

Use the following keywords to search:

  • emfrom to search the sender's name and email address
  • em for a general subject + content search
  • emsubj to search specifically for a subject line

You can download it here. Enjoy!

 

[Edit: This is the Alfred 3 version of the workflow, updated in 2018]

Share this post


Link to post

Not working. goes to fallback search after entering any word after keyword+space/enter.

 

Before you add a space, do you see "emsubj" show the "Search Mail.app by subject line" text with the Mail icon next to it?

Share this post


Link to post

Before you add a space, do you see "emsubj" show the "Search Mail.app by subject line" text with the Mail icon next to it?

Thanks for creating this workflow. It seems to be half working for me. When I type emsubj, em, or, emfrom I see the text with the Mail icon next to it, but then as soon as I hit space, it defaults to the fallback searches. Just to make sure I have my other settings correct, what should be checked under Default Results and the user defined file types under Advanced?

 

Thanks in advance.

~Linnea

Share this post


Link to post

Thanks for creating this workflow. It seems to be half working for me. When I type emsubj, em, or, emfrom I see the text with the Mail icon next to it, but then as soon as I hit space, it defaults to the fallback searches. Just to make sure I have my other settings correct, what should be checked under Default Results and the user defined file types under Advanced?

 

Thanks in advance.

~Linnea

 

This is likely to be because no relevant items are returned; if there are no results at all, it'll switch to fallback searches.

 

Basic question but do you use Mail.app for your email? If you navigate to ~/Library/Mail/, what does it contain? The file filters need to be pointing to the right place, so if you have no emails stored there, you'll get the behaviour you're seeing.

Share this post


Link to post

Very nice, thank you.

Best Mail.app workflow I´ve seen.

 

But it doesn´t seem to show the results correctly sorted, based on the date it was received?

That would be absolutely awesome!

 

But nevertheless I will use this workflow very often! :)

Share this post


Link to post

how can i add a search for recipient ie the the messages I send to SOMEONE?  tried to add a filter and added 

 

"kMDItemRecipient" but does not work, whats the right syntax?

 

otherwise it works just fine

 

 

just found it:  it is kMDItemRecipients   and kMDRecipientsEmailAddresses   with an "s"

Edited by kw1

Share this post


Link to post

Very nice, thank you.

Best Mail.app workflow I´ve seen.

 

But it doesn´t seem to show the results correctly sorted, based on the date it was received?

That would be absolutely awesome!

 

But nevertheless I will use this workflow very often! :)

 

Any update on the sorting issue?  This is a great workflow, but not having the emails sorted by date does make this workflow less valuable.  For instance, I search for a subject, and the list returns a list of emails with the same or similar subject line (e.g., an email chain).  I know I want the latest email in the chain, but since the results are not in chronological order, things get messy.

Share this post


Link to post

Any update on the sorting issue?  This is a great workflow, but not having the emails sorted by date does make this workflow less valuable.  For instance, I search for a subject, and the list returns a list of emails with the same or similar subject line (e.g., an email chain).  I know I want the latest email in the chain, but since the results are not in chronological order, things get messy.

 

There is no sorting as such as the workflow returns them in the order OS X feeds them back, but you can have a play with date ranges :)

 

You can create additional keywords and go to the file filter's advanced tab, where you can add a date range, e.g. one for today's mail, one for mail within the past 30 days. 

Share this post


Link to post

Would it be possible to list all unanswered Emails from one recipient or contact with this or another workflow?

 

I highly doubt that information is available as part of the metadata relating to an email; The metadata contains information about that particular message, not about its relationship to other messages, so it wouldn't be possible (as far as I know) to find out whether an email has been answered or not.

Share this post


Link to post

The workflow's no help to me, as I use MailMate, but I can't express how happy I am to see a workflow by you.

"Dogfooding" is by far the best way to create great products.

I'd love to see lots more workflows from you and Andrew, and if I could only have one "feature request" ever, it would be to have some workflows written by you guys.

Edited by deanishe

Share this post


Link to post

The workflow's no help to me, as I use MailMate, but I can't express how happy I am to see a workflow by you.

"Dogfooding" is by far the best way to create great products.

I'd love to see lots more workflows from you and Andrew, and if I could only have one "feature request" ever, it would be to have some workflows written by you guys.

 

Glad to see you're enjoying this one ;) I've created a bunch for internal use, and frequently create various hotkey and file filter-based workflows for users that are certainly nowhere near as exciting as the fantastic ones you've all been creating!

 

Please do keep bringing the best ones to my attention as I also love sharing them with users who are just beginning to discover how powerful workflows can be. In fact, my intention is to feature them more regularly on the Alfred blog, so expect to see more in the coming weeks! :)

 

Cheers, 

Vero

Share this post


Link to post

Love this workflow.  One suggestion, would be be possible to make the message path more readable by parsing out the email account name and folder name and just displaying those under the message result subject?

Share this post


Link to post
10 hours ago, Vero said:

 

@paulminors No problem, I've updated the link in the first post :)

 

You can also grab it here:

https://www.dropbox.com/s/5h3djhw2thf8xjp/Mail.app Search 3.0.alfredworkflow?dl=0

 

Cheers,
Vero

 

Thanks Vero, that's great! Is there a way to customise this so I could type my search e.g. "emfrom paul" and then hit enter to open Mail.app and go to the search results i.e. search bar is pre-filled with the query?

Share this post


Link to post

@paulminors This depends on whether Mail supports AppleScript for this, but this part is down to Mail's own functionality.

 

Alternatively, you could probably use a Dispatch Key Combo object, but this can be less reliable.  It's likely that another fellow forum member can help you with the AppleScript. :)

 

Cheers,
Vero

Share this post


Link to post
On 3/29/2013 at 7:08 PM, Vero said:

 

This is likely to be because no relevant items are returned; if there are no results at all, it'll switch to fallback searches.

 

Basic question but do you use Mail.app for your email? If you navigate to ~/Library/Mail/, what does it contain? The file filters need to be pointing to the right place, so if you have no emails stored there, you'll get the behaviour you're seeing.

 

Thank you for the guide. I am also having a same issue. 

I found my ~/Library/Mail/ doesn't contain any files in it, however if I am using Mail.app, how can I move the actual email files to this library/mail/ folder? 

 

BR,

Sumin

Edited by sumin

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...