Dissecting an incoming mail

  • Thread starter Thread starter Frode Lillerud
  • Start date Start date
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!
 
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??
 
Back
Top