A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Removing headers from email, replacing rules with code



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old November 14th 06, 02:00 AM posted to microsoft.public.outlook.program_addins
Tony Gravagno
external usenet poster
 
Posts: 12
Default Removing headers from email, replacing rules with code

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).Va lue
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
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing downloaded headers from my Inbox Brendan Burns Outlook - General Queries 1 September 18th 06 03:20 PM
Removing Rules per Script Markus R. Outlook - General Queries 3 August 30th 06 03:05 PM
Removing Message Rules Jack Gillis Outlook Express 4 July 12th 06 10:05 PM
removing headers Bluesky Outlook - General Queries 1 April 12th 06 09:33 PM
OL 2002 SP3 : removing headers Bluesky Outlook - General Queries 0 April 11th 06 03:08 PM


All times are GMT +1. The time now is 06:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.