Dissecting an incoming mail

F

Frode Lillerud

Hello all.

I'm writing an antispam add-in for Outlook in C#.
I'm able to trigger an event when a new message arrives, but I would like
to work with it before it reaches the Inbox.

How can I access all the headers and body info of the incoming mail?

I want to be able to move to the mail to the correct folder after checking
the contents.

Code examples (in C#) would be very helpful!
 
F

Frode Lillerud

A pseudo-code of what I want to do follows:


public void MethodForHandlingIncomingMail(MailItem newmail)
{
print(newmail.body);

if (body contains "spam")
{
//send mail to spamfolder
}
else
{
//send mail to inbox
}
}




How can I get ahold of the new mail as a MailItem??
 

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