Filtering on "To:email.address" (urn:schemas:mailheader:to)

U

Unknown

I'm converting to Outlook.

In my old email system I could set up a single rule like this
"put all email where any-recipient contains @corp.example.com or
any-recipient contains @sales.example.com or any-sender contains
@corp.example.com or any-sender contains @sales.example.com into folder X"

And this simple rule would match any To/CC/Bcc/From/Sender field and put
everything in a folder.

I'm trying to do the same in Outlook with no luck.

What I tried so far

1) Use a real folder and rules (make outlook move all sent/received emails
for a domain into a folder)
Problems:
- mail received from @*.example.com goes into the right folder but no
"envelope icon" in system tray. I googled for work-arounds but found none
for the envelope icon issue, just ways to make the desktop alert overlay
stays longer (not ok for me)
- I correctly set-up the archiving of sent messages in the @*.example.com
folder by disabling the saving of outgoing messages into "outbox" and
creating a rule for copying the mail for @example.com to its folder and a
default rule to copy everything else into "outbox". However, I also use a
rule to "delay sending of all mail for 1 minute" so that if I mistakenly
push "send" I have a way to recover from it. If I delete an email from
"outgoing" during this delay, the email has already being copied into
"outbox" or "example.com", which is confusing. (This won't happen if you go
the normal route and leave "save a copy of sent message in outbox", since
the email will go to the outbox only after the delay).

2) Use search folders (leave everything in outbox/inbox and use virtual
search folders to group mail sent/received for a domain)
I enabled QueryBuilder to be able to do "fine tuning" and started creating
rules, but unfortunately the fields the GUI allow you to work on ("To"
"From" "Cc" ....) are the "display" fields not the actual email header
fields, so that if you send an email to
(e-mail address removed)
and use a filter on
To: contains example.com
it will work, but if you send email to
"User" <[email protected]>
then the filter will match the display name "User" and will not match
example.com

3) Use search folders + "view filter"
ie: build a search folder with everything (inbox and outbox) and try
filtering the @example.com domain via DASL/SQL filter.

Again, there's a problem with Outlook wanting to use "display fields" and so
precluding me from matching on email addresses:
- matching on urn:schemas:mailheader:to
"urn:schemas:mailheader:to" LIKE '%something%'
does not work (google shows I'm not the only one having this problem)
- however, matching on urn:schemas:mailheader:subject works, so there must
be something weird about "to" (and cc and from)
- matching urn:schemas:httpmail:fromemail works, but this solves only half
of the problem (only the received emails, not the sent ones).
- I tried using
"http://schemas.microsoft.com/mapi/proptag/0x0e04001f"
but again, this is the display name


I don't know what else to try.

Google shows there are others having experienced problem #2 and #3.

I think this should be a very common usage scenario, but apparently it's
not. Anyone solved a similar issue? How?

Thanks
 
D

Diane Poremsky [MVP]

The To field on the first tab should work - except if you have an exchange
acct and the To address is a SMTP address on your exchange box.

(See http://www.outlook-tips.net/archives/2006/20060831.htm - it works the
same for both to and from addresses. )


--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
(e-mail address removed)

EMO - a weekly newsletter about Outlook and Exchange:
(e-mail address removed)

You can access this newsgroup by visiting
http://www.microsoft.com/office/community/en-us/default.mspx or point your
newsreader to msnews.microsoft.com.
 
U

Unknown

Diane Poremsky said:
The To field on the first tab should work - except if you have an exchange
acct and the To address is a SMTP address on your exchange box.

(See http://www.outlook-tips.net/archives/2006/20060831.htm - it works the
same for both to and from addresses. )

Thank you.

I put
@example
In View filter -> Message -> To
and it correctly filters on email addresses.

However, if I then go in the SQL tab and just check the checkbox to use the
SQL syntax it created based on my "Message -> To -> @example"

("http://schemas.microsoft.com/mapi/proptag/0x0e04001f" CI_STARTSWITH
'@example' OR "http://schemas.microsoft.com/mapi/proptag/0x0e03001f"
CI_STARTSWITH '@example')

then the results are unexpectedly different (much less messages). I was
expecting that if I use the GUI and get one result set, and then just check
the checkbox of the SQL it created based on my GUI choices I should get the
same result set.
Is my assumption correct as far as you know?

I tried looking for a logic in what messages get lost using SQL and it seems
to me that using SQL will again switch to "display name" instead of "email
address".

In fact, if I search for the hex codes in the SQL, I find
http://msdn.microsoft.com/en-us/library/ms527058(EXCHG.10).aspx
0x0e04 -> DISPLAY_TO

http://msdn.microsoft.com/en-us/library/ms526814(EXCHG.10).aspx
0x0e03 -> DISPLAY_CC

I think there's some kind of inconsistency between the GUI and the SQL.

I need to use SQL in order to use OR, ie:
I use
View filter -> Message -> To: @corp.example.com ; @corp2.example.com
and Outlook uses AND while I need OR. I edit the SQL syntax to use OR but
like it doesn't work with just 1 condition, it's the same with 2.

BTW: I don't have an Exchange account, I have MS-MAIL and SMTP accounts. The
filtering I'm trying to do is on SMTP messages.

Reading the MS docs it seems I need to use urn:schemas:mailheader:to in the
SQL, unfortunately that won't work.

Thanks
 
U

Unknown

Brian Tillman said:
First, Outlook doesn't support wildcards in the rules, so "*.example.com"
means nothing. Second, rules run before the thread that displays the mail
notification icon. If a rule moves a message, the icon won't be displayed.
That's why the rule actions allow you to specifiy a notification action.

Thank you.

Unfortunately I was not clear.
I actually use the complete @[email protected] @corp2.example.com or similar
multiple domains in all Outlook fields; I used the *.example com expression
to avoid writing it to many times in my post without thinking I would have
made things more complicated for readers. Sorry for this.
What do you think the point is in copying a message to Outbox? That's not
how to send a message. Copying to Outbox does not schedule a message for
sending. Do you instead mean the Sent Items folder?

Sorry again.
My Outlook is in Italian and I don't know the exact translations :(
I mean that by default a message is saved in a folder where all the messages
you send are placed when they've actually been sent.
So I disabled that rule (tools, options, preferences, email preferences,
2nd check box from the top something like "save a copy of the messages in
email sent")

Right now I found this
http://www.howto-outlook.com/howto/sortoutgoingmail.htm
this is exactly what I did.
Confusing to me, for sure, since outlook doesn't have any folder named
"outgoing"

Let's say:
Folder A=where mail goes while "in transit", while Outlook is trying to send
it
Folder B=where mail goes when it's been sent.

Usually mail stays in A just for a fraction of a second or a few seconds,
and then it goes in B when it's sent.
If I delay all the email by 1 minute, mail will stay in A for 1 minute and
then is sent and goes to B.

If I delete an email while it's in A:
- if outlook is set as per default: mail is deleted from A and is not put in
B (behavior I like)
- if outlook is set up with rules to forward email from a domain to a folder
X, and default rule to copy all remaining email to B
http://www.howto-outlook.com/howto/sortoutgoingmail.htm
-> then email I deleted from A is and remains in B also (behavior I find
confusing)

Thanks
 
D

Diane Poremsky [MVP]

I know of one bug in the SQL implementation - it looks there might be
another. (We discovered a few weeks ago that copying the SQL code then
pasting it right back fails as invalid code.)

If the To field in the filter is creating SQL code for to and cc - enter the
domains in the To field with comma separation. Criteria is AND'd together
when the fields are different but OR'd if they are the same.

Also - if you are filtering all mail to *.example.com, you can use just
example.com or .example.com.

--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
(e-mail address removed)

EMO - a weekly newsletter about Outlook and Exchange:
(e-mail address removed)

You can access this newsgroup by visiting
http://www.microsoft.com/office/community/en-us/default.mspx or point your
newsreader to msnews.microsoft.com.
 
U

Unknown

Diane Poremsky said:
If the To field in the filter is creating SQL code for to and cc - enter the
domains in the To field with comma separation. Criteria is AND'd together
when the fields are different but OR'd if they are the same.

My problem is that I need to configure a rule for

From: domain1 or domain2
OR
To/CC: domain1 or domain2

Using the GUI of both "search folders" or "view filter", and putting the
data in the "To:" or "From:" of the first "message" tab as you told me I can
succesfully do just
From: domain1 or domain2
or just
To/CC: domain1 or domain2

When trying doing the OR:
1) search folders -> query builder: it works on display fields
2) view filter -> SQL: it still works on display fields even if it's written
by outlook itself based on my GUI choices

Thanks
 
D

Diane Poremsky [MVP]

Yeah, if you are doing To and From, the to and from are AND'd together.

I would probably do it one of two ways - a new rule that checks the from
address and one that checks the to - either rule will move the messages to a
folder. Or one rule that looks for words in the header. Create an Unread
mail search folder to easily monitor new messages, rather than rely on the
envelope icon or new mail sound. Create a second search folder for the sent
box and drag the sent messages to the folder with the other mail every now
and again.

If you need instant notification, the Rule that moves them can pop up an
alert - either the blue toast or a dialog. A rule can also play a sound or
run an app or script. If you really want envelopes in the tray, I'm pretty
sure you could find something to run off the rule to add the envelope. (My
sound is almost always off and the tray is too cluttered to see the mail
icon.)

--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
(e-mail address removed)

EMO - a weekly newsletter about Outlook and Exchange:
(e-mail address removed)

You can access this newsgroup by visiting
http://www.microsoft.com/office/community/en-us/default.mspx or point your
newsreader to msnews.microsoft.com.
 
G

Gosh Mammadov

Could anyof you please help to get this filter correct?
I need to set filter to separate some emails from others and put them on top if possible please.

Filtering to SUBJECT - containing "example" to go top on the inbox and be separated from all others...

Many th

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com/default.aspx?ref=ng
 
B

Brian Tillman [MVP - Outlook]

Could anyof you please help to get this filter correct?
I need to set filter to separate some emails from others and put them on
top if possible please.

Filtering to SUBJECT - containing "example" to go top on the inbox and be
separated from all others...

What you describe, sorting a folder via a filter, doesn't seem possbile.
Instead, why not create a rule that will move any message containing
"example" in the subject to another folder and then run the rule?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top