Can I create my own Junk Mail Filter for Outlook 2010 using Visual Studio 2010?

Sometimes Outlook's Junk Mail Filter filters messages that I am expecting into the junk mail folder so my rules don't get a chance to process them.

Is there a way to programmatically interact with Outlook's junk mail filter?

If not, how difficult would it be to create my own junk mail filter for Outlook? I'm not asking about the various techniques you would employ to determine if a message is junk or not. Just the mechanics of being able to look at each message as they are delivered.

I'm a developer and have written COM Add-ins for Outlook in the past, most recently using Visual Studio 2010 and VB to target Outlook 2010 x86 and x64.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi, ou81aswell.

I'm afraid the answer is "no".  The junk mail filter built-in and there's no way I know of to manipulate it at the Outlook end.  If your mail is on an Exchange server, then the filtering is actually done at the server.  It calculates a value called the "spam confidence level" (SCL for short).  If the value is above some threshold, then the item is considered spam and dumped into the junk mail folder.  I'm not enough of an Exchange expert to know if it's possible to manipulate what the spam rules look for at the Exchange end, but I have seen articles (links below) that mention adjusting the level.

ou81aswellAuthor Commented:
I'm using POP3 but appreciate that Exchange does its own processing.

The NewMailEx event looks promising but I can't tell if the junk mail filter will prevent my addin from seeing the messages it decides are junk.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

David LeeCommented:
You can create you own junk filter, but that won't affect the built-in junk filter.  I've done that to filter things that the built-in filter doesn't.  You're likely to run into the same thing I have which is that the built-in filter moves an item the code is processing resulting in an error.
ou81aswellAuthor Commented:

"You can create you own junk filter" - How do you go about doing that? Is it just an OL add-in that handles the NewMessageEx event or is there a different mechanism?
David LeeCommented:
It's just an Outlook macro or add-in that's triggered by NewMailEx and processes messages as they arrive.  Think of it as a secondary spam filter that can be used to catch messages that the built-in filter misses.  You could take a similar approach and write an process that monitors the Junk Items folder and moves items that you feel were misidentified back to the inbox.
ou81aswellAuthor Commented:
I see. So NewMessageEx will get the message but so will the built in Junk Filter and that will move it to the junk folder at the same time I'm trying to figure out what to do with it. Since the message gets moved, the handle I have to it (its msg id I believe) becomes invalid because it gets changed by the move.

Is that correct? If so then I guess there is no way to create your own Junk Mail Filter that replaces Outlook's built in one.
David LeeCommented:
Yes, that's correct.  That's what I was explaining when I said "You can create you own junk filter, but that won't affect the built-in junk filter."  Anything you write is going to be "in addition to" the built-in filter no "in place of".  I'm not aware of any way to stop the built-in filter or alter its behavior.  

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ou81aswellAuthor Commented:
It's a pitty there is nothing you can do about Outlook's Junk mail filter. This makes rules processing a potential waste of time. I wish they would give us the ability to specify that any message that contains a certain phrase should never be considered Junk mail.

Thanks guys!
David LeeCommented:
You're welcome.  Glad I could help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.