views:

39

answers:

2

I have a .NET application that polls an Exchange email mailbox for new messages on a scheduled basis. Further processing happens when new messages are found in the email mailbox. I've encountered an issue with the processing when auto reply messages are received in the mailbox [e.g. auto reply rule, or Out of Office messages].

I need a C# solution to determine if an Exchange mail item is an auto reply message. Is there an attribute on the mail item that indicates if the message is an auto response message?

A: 

Hi,

The auto response information forms part of the header, and sometime the subject and body. It all depends of the server that did the auto response.

I personally use a 3rd party component to assist with the parsing of the emails. It is called ListNanny.

It has a parser engine, and a definition file, and can assist with some additional NDR types, such as Hard and Soft Bounces, ChallengeVerification, DnsError emails, and more.

If I get an "Unknown" type back using ListNanny, I then assume it is a correct email

Hope this helps

EDIT:

After the comment. My other suggestion would be to generate a couple of different types of Auto Respond messages.

From there you view the headers of the emails manually, find any entries that might indicate that it is an Auto Respond message (which does not appear on normal message), and then write your own email parser to if an email contain any of those Auto Respond 'signature', and then flag it as such.

I can only tell you that when you start off you'll most probably have a lot of False-Positives, or Positive-False emails, but this will get better after a while, and after you've processed more emails and refined your signature.

Sorry i couldn't have been more of assistance to provide you with code samples or other ideas.

Riaan
@Riaan - I was hoping not to use a 3rd party component for this effort. Purchasing a third party tool just to check if a message is an auto response seems unnecessary.
Robert Williams
understandable.
Riaan
A: 

After struggling with this problem for a while I decided to just use the simplest approach possible.

By using the Exchange web service (exchange.asmx) that is available to Exchange 2007 I decided to just check the subject line of each mail item to see if it contained "Out of Office" before continuing through the processing logic. All of the messages that I was dealing with were auto-reply messages that contained the "Out of Office" subject line.

I'm sure that I'll come across additional use cases of auto-reply messages that do not have "Out of Office" that I'll have to account for in the future. At that time I'll either modify the code to check the subject line against an array of possible subject lines, or continue searching for some additional attribute on the mail item that indicates an auto reply message.

I'm pretty sure that additional attribue is the "Return-Path:" value in the header of the mail item, but I haven't found an easy way to get that attribute. From what I can tell, if the "Return-Path" has a "<>" value, it is an auto reply message otherwise it would have a valid email address.

Robert Williams