T
Tony Gravagno
Is there a standard way to remove headers from inbound mail items?
Can I do something with Redemption like this?:
sItem.Fields(PR_TRANSPORT_MESSAGE_HEADERS).Item(x).Delete()
Can I do this with PIA and C#?
The problem I'm trying to solve is that the Outlook 2003 rules
sometimes don't process. This could be because I have way too many
rules (about 150 now) but I think it's more because our mail server is
now adding a lot more header info to inbound mail. There is a long
stream of Received headers, headers to tell us how the server
anti-spam rated each mail item, and others. I think Outlook 2003 is
confused by so many headers because my filtering no longer works on
many items since we changed servers.
So before rules are processed, I want to remove selected headers.
I found some code by Ken Slovak for reading the headers:
Dim oPropAccessor As Outlook.PropertyAccessor
Const PR_MAIL_HEADER_TAG = _
"http://schemas.microsoft.com/mapi/proptag/0x007D001E"
'only works if Application.IsTrusted is True
Set oPropAccessor = oItem.PropertyAccessor
Another way to do this is with CDO:
Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E
strID = myItem.EntryID
Set objMessage = objCDO.GetMessage(strID)
Set objFields = objMessage.Fields
txt = objFields.Item(CdoPR_TRANSPORT_MESSAGE_HEADERS).Value
strHeaders = oPropAccessor.GetProperty(PR_MAIL_HEADER_TAG)
The question is whether or not we can modify the resulting header
string and then write back into these header fields.
This is the first part of a two-part effort. I've never liked Outlook
rules. I have about 150 of them (I know, too many) and they never
really did process properly, so I'm going to write C# code (maybe open
source) to replace the Outlook rules (unless someone can tell me
Outlook 2007 is VASTLY better). My first step is to remove junk
headers. The second step is to use the remaining headers and mail
item to match on user-defined strings and regexp patterns, sort mail
based on specs in Contact items and config files, etc.
Thanks!
Tony
TG@ removethisNebula-RnD.com
Can I do something with Redemption like this?:
sItem.Fields(PR_TRANSPORT_MESSAGE_HEADERS).Item(x).Delete()
Can I do this with PIA and C#?
The problem I'm trying to solve is that the Outlook 2003 rules
sometimes don't process. This could be because I have way too many
rules (about 150 now) but I think it's more because our mail server is
now adding a lot more header info to inbound mail. There is a long
stream of Received headers, headers to tell us how the server
anti-spam rated each mail item, and others. I think Outlook 2003 is
confused by so many headers because my filtering no longer works on
many items since we changed servers.
So before rules are processed, I want to remove selected headers.
I found some code by Ken Slovak for reading the headers:
Dim oPropAccessor As Outlook.PropertyAccessor
Const PR_MAIL_HEADER_TAG = _
"http://schemas.microsoft.com/mapi/proptag/0x007D001E"
'only works if Application.IsTrusted is True
Set oPropAccessor = oItem.PropertyAccessor
Another way to do this is with CDO:
Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E
strID = myItem.EntryID
Set objMessage = objCDO.GetMessage(strID)
Set objFields = objMessage.Fields
txt = objFields.Item(CdoPR_TRANSPORT_MESSAGE_HEADERS).Value
strHeaders = oPropAccessor.GetProperty(PR_MAIL_HEADER_TAG)
The question is whether or not we can modify the resulting header
string and then write back into these header fields.
This is the first part of a two-part effort. I've never liked Outlook
rules. I have about 150 of them (I know, too many) and they never
really did process properly, so I'm going to write C# code (maybe open
source) to replace the Outlook rules (unless someone can tell me
Outlook 2007 is VASTLY better). My first step is to remove junk
headers. The second step is to use the remaining headers and mail
item to match on user-defined strings and regexp patterns, sort mail
based on specs in Contact items and config files, etc.
Thanks!
Tony
TG@ removethisNebula-RnD.com