COM Addin for Spam Detection

M

Moasat

I've written an add-in that uses SpamAssassin to detect
Spam. Similar to the SAProxy, I'm trying to create a new
message in a 'Spam' folder, then attach the original to
it. This all seems to work well, I'm actually copying the
original so as to retain all of the properties/headers,
etc.

My problem comes in when Rules are also in place.
Apparently the Rules can take effect before my addin gets
notified via OnNewItem. For lack of a better method, I'm
wanting to set a timer for about 5-10 seconds that will
come through and scan all folders for any unread mail that
may have been moved via a Rule and process them. I'm
doing this via a second thread and my assumption is that
this is really messing with Outlook in general.

With the second thread, in the worst case scenario,
Outlook will now crash somewhere way down in OUTLIB or
some other module. In most cases, this will happen during
a call to Move the item to the Spam folder. (spMailItem-
Move(...). It will crash other times when I'm trying to
change the body of the message using put_Body(...).

Regardless, I seem to have a problem with Outlook not
wanting to shutdown. I've verified that my second thread
is closing, and all handles to everything are being
released/closed etc via smart pointers.

To really add to the confusion, any customization I
perform to the Standard Toolbar, or to a Custom toolbar,
seems to be lost. Whether Outlook actually shutsdown on
its own or if I have to kill the process. This happens on
two different machines. I've tried updating to Office SP3
and all the latest updates I can find but nothing has
helped. Even if I remove my addin from Outlook, it still
happens.

My questions are:

1. Assuming the second thread calls
OleInitialize/Unintialize, is Outlook still not very
thread safe? Even with CritSections, is it not happy with
multiple threads from Addins?

2. Why are the toolbars suddenly reverting back to default?

Thanks for any info anyone can offer.

Info:

Windows 2000 Pro
Office 2000 Premium SR-1
MS Visual C++ 6.0
(Don't know what else you might need, but please ask)
 

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