Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Use boolean expressions in Mail 2.0 Apps
Tiger only hintHaving read a previous poster's great suggestion for the use of Apple regular expressions in Spotlight, I thought I'd try it with Mail 2.0 Smart mailbox feature. I had a Smart mailbox that included all mail messages with xxx ANYWHERE in the Message Body. That worked well, until I realised that it excluded a few messages that could be identified just by their 'From' field.

I then edited the Smart mailbox definition by clicking on the '+' and adding From contains YYY. But the result of this is a logical AND, so that the result was it would only give me messages that contained 'xxx' in the message body AND 'YYY' in the From field.

I then edited the Smart mailbox definition to read xxx | YYY anywhere in the message, and sure enough, it found the complete set. I'm sure you can extend this with OR and NOT, but I don't know the regular expressions for these in Apple's new scheme.
    •    
  • Currently 1.80 / 5
  You rated: 2 / 5 (5 votes cast)
 
[15,976 views]  

10.4: Use boolean expressions in Mail 2.0 | 18 comments | Create New Account
Click here to return to the '10.4: Use boolean expressions in Mail 2.0' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Use regular expressions in Mail 2.0
Authored by: Alrescha on May 25, '05 10:23:05AM

I think the original poster meant to say 'boolean' expressions, unless Mail 2.0 is a lot more flexible than I suspect.

A.



[ Reply to This | # ]
10.4: Use regular expressions in Mail 2.0
Authored by: derPlau on May 25, '05 02:58:30PM

Right - these are boolean, not regular, expressions. Rob, maybe you could change the headline so grep geeks like me don't get all excited for no reason?



[ Reply to This | # ]
10.4: Use regular expressions in Mail 2.0
Authored by: da5idonimac on May 25, '05 11:14:53AM

i am not sure if i am missing something, but when editing the rules for a smart mailbox, you can add multiple rules and sepcify whether one or all rules have to apply.

i see there is a problem if you have 3 or more rules and want something like (x AND y) OR z. however, in the case of the poster you could simply specify to add the email if one argument of the two applies.



[ Reply to This | # ]
10.4: It IS a bug, and exists with FILTER Rules as well
Authored by: keymaker on May 25, '05 12:21:38PM

"i see there is a problem if you have 3 or more rules and want something like (x AND y) OR z. however, in the case of the poster you could simply specify to add the email if one argument of the two applies."

That's exactly what they meant. The OR (ANY) selection within mail DOES NOT WORK the way it's supposed to when you've selected the 'Entire Message' & 'Contains'. I noticed this problem immediately after upgrading 3 weeks ago and using the smart folders like a filter. By the way the FILTER RULES have the EXACT same problem.

Just as the example of what i did.

I have a smartbox with 7 parameters ranging from Subject, To, From, Any Recipients, (lets say the parameters are AAA, BBB, CCC...etc). Using OR (ANY) of the rules putting the messages into the folder, I end up with 139 emails that have at least 1 of the parameters. Duplicating a parametter, say AAA BUT for "entire message" Gave me 1 result, however, unlike the original posting here, it did NOT meet all 8 parameters. So for me at least, it did not turn the rule into a purely AND rule. Either way, as a purely OR type rule set you should never have reduced results when adding a new parameter to an OR style restriction.

I've already sent a bug report to apple, but maybe someone should send another one so they know it isn't an isolated case. I've already duplicated this problem and several computers.



[ Reply to This | # ]
10.4: It IS a bug, and exists with FILTER Rules as well
Authored by: designbot on May 25, '05 02:34:16PM
This bug is very annoying, and makes the Smart Mailboxes all but useless for me. (As a side note, why can we search for messages sent by members of a certain group, but not messages sent to members of a certain group?) How do we report it to Apple?

[ Reply to This | # ]
10.4: It IS a bug, and exists with FILTER Rules as well
Authored by: n8gray on May 25, '05 05:14:06PM

https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa

You will have to sign up for a free ADC membership if you haven't already.



[ Reply to This | # ]
10.4: It IS a bug, and exists with FILTER Rules as well
Authored by: pediddle on May 26, '05 12:15:36AM

I agree -- not being able to search for messages TO a group makes smart folders useless for me. I'd like to have a smart folder containing all my conversations with a group, but without including sent mail, I only see half the conversation!



[ Reply to This | # ]
10.4: It IS a bug, and exists with FILTER Rules as well
Authored by: designbot on May 26, '05 01:06:33PM

I posted a bug report for the smart folders, and a feature request for finding messages sent to a group.



[ Reply to This | # ]
10.4: It IS a bug, and exists with FILTER Rules as well
Authored by: moritzh on May 27, '05 08:55:54AM

You are right, this is so annoying. I had 3 or 4 cool ideas about using smart folders (including what you wanted to do), but because of stupid GUI limitations such as this one I could not accomplish any of them. Sad. Smart folders are useless for me.



[ Reply to This | # ]
10.4: Use regular expressions in Mail 2.0
Authored by: designbot on May 25, '05 01:02:54PM
I have encountered the same kind of bugs setting up smart mailboxes. I don't quite understand the hint, though. How do you "edit the Smart mailbox definition to read xxx | YYY anywhere in the message"? Are you saying the definition should be Entire Message > Contains > 'xxx | YYY'? And how does this get Mail to search for YYY in the "From" field? I don't understand this hint at all.

[ Reply to This | # ]
10.4: Use regular expressions in Mail 2.0
Authored by: boredzo on May 25, '05 02:58:13PM
Mail does support Boolean expressions, but not regular expressions. man re_format if you want to know what regular expressions really are.

[ Reply to This | # ]
10.4: Use regular expressions in Mail 2.0
Authored by: ryo on May 25, '05 03:01:48PM

The title of this hint really should be changed to something like "Use boolean expressions in Mail 2.0" since the expressions used in the examples are *not* regular expressions at all but boolean expressions (expressions using the terms 'and', 'or', and 'not').

I know it may sound pedantic, but I got really excited when I read the title and was then let-down when I read the article and found out that, no, Mail still does not recognize regular expressions. I've been hoping and waiting for OS X to have native regular expression search capabilities for a long time now - hence the let-down.

Ah Spotlight with regular expressions! How cool would that be?



[ Reply to This | # ]
10.4: Use boolean expressions in Mail 2.0
Authored by: robg on May 25, '05 03:20:47PM

Sorry for the misleading title; I should have caught it in editing, but I didn't :). It's fixed now.

-rob.



[ Reply to This | # ]
10.4: Use boolean expressions in Mail 2.0
Authored by: GaelicWizard on May 26, '05 02:13:31AM

I'm really amazed. This hint does not a thing in the world, doesn't make any sense, and if you are very careful to read it exactly, isn't related to Mail.app at all, since there is almost no text in the "Smart Mailbox definition", which itself doesn't refer to anything.

Rob: If you know what this guy is talking about, then rewrite the hint to be vaguely understandable. If not, then I suggest you pull it.

---
Pell



[ Reply to This | # ]
10.4: Use boolean expressions in Mail 2.0
Authored by: designbot on May 26, '05 01:09:38PM

Amen.



[ Reply to This | # ]
10.4: Use boolean expressions in Mail 2.0
Authored by: mayo2ca on May 26, '05 01:15:24PM

Interesting, great thing to remember.

Yesterday I found you can alter the SmartMailboxes.plist file to do nested boolean queries, for eg "Message date is today AND Message is in Mailbox Inbox OR Message is flagged". It's just matter or inserting more Criteria elements and shuffling/nesting things around. The only disadvantage is that the ability to modify the particular smart mailbox is lost within Mail. I'm currently writing an app to make it easier to modify the smart mailboxes.



[ Reply to This | # ]
10.4: Use boolean expressions in Mail 2.0
Authored by: mayo2ca on Feb 15, '07 10:36:13AM
I've had enough people ask me about this, so here it goes ...

I've never had time to finish, or even properly start the app. Or rather the problem is that my coding skills lack greatly in the UI/GUI realm and I never had the time to play and figure out how to render these things to make it easily editable for people. If you know of anyone, let me know, I'll be glad to work with them. I can handle the code generating the queries no problem.

I threw up a quick guide today (enough of repeating and re-writing of emails). It's not really polished yet, but by the end of today (Feb 15, 2007) it should be.

Hope this helps at least a little bit. http://oyam.ca/past/2007/2/15/complex_criteria_with_smart_mailboxes/

regards,
mayo

[ Reply to This | # ]
Boolean searches in Mail: a better explanation for non-programmers
Authored by: horhey23 on Aug 03, '07 10:39:54AM
This page over at MacWorld explains exactly how to do boolean searches within Mail, with screenshots. Works like a charm with Smart Folders, you can drop these right into the entry fields in the Smart folder settings panel.

http://www.macworld.com/2006/10/secrets/novworkingmac/index.php

[ Reply to This | # ]