I am afraid, that this is a feature of the server. I have done two tests:
- I found a mail in my exchange with a custom header using Outlook 2010. I downloaded the message using POP3 and the header was not included (same as your case).
- I created a mail with
X-KCOMIHS-ID
header and sent it from my gmail to my exchange. I downloaded it and surprisingly the header was there.
It seems that custom header behaviour depends on how was the message created/received.
I googled a little bit about this and found probable cause: http://serverfault.com/questions/365666/imap-losing-x-header-from-exchange-server
It refers to a useful Microsoft blog http://blogs.technet.com/b/stuartp/archive/2009/12/08/new-feature-in-exchange-server-2007-sp2-headerpromotionmodesettings.aspx
You can also find this post valuable: http://msdn.microsoft.com/en-us/library/exchange/hh545614%28v=exchg.140%29.aspx
Actually, when you load the saved MSG file into the MailMessage
object, you will see that the X-KCOMIHS-ID
header is there:
MailMessage mail = new MailMessage();
mail.Load("path_to_saved.msg");
mail.Headers["X-KCOMIHS-ID"];
Please note that Rebex POP3 parses and stores all headers it receives from the server. No headers are omitted. The easiest way to see raw data received from the server is to use the LogWriter property like this:
pop3.LogWriter = new Rebex.FileLogWriter(@"c:\temp\pop3.log", LogLevel.Verbose);
Pop3MessageInfo fullInfo = pop3.GetMessageInfo(1231, Pop3ListFields.FullHeaders);
pop3.LogWriter = null;