Missing headers when calling Pop3 GetMessageInfo with full headers option

0 votes
asked Dec 10, 2012 by Pozzy (140 points)
edited Dec 11, 2012

Hi, I've got a header missing when calling the Pop3 GetMessageInfo method. All the other headers are there. I can see the header when I view the mail in Outlook (2010) and look in the internet-headers on the properties page, or when I save the mail as a .msg file from Outlook.
Are there any reasons for a header not to show up?
The header is named X-KCOMIHS-ID

Applies to: Rebex Secure Mail
commented Dec 10, 2012 by Lukas Pokorny (95,290 points)
edited Dec 10, 2012

Can you see the header in the download message if you download the whole message using Pop3.GetMessage method?

1 Answer

0 votes
answered Dec 10, 2012 by Lukas Matyska (47,270 points)
edited Dec 11, 2012

I am afraid, that this is a feature of the server. I have done two tests:

  1. 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).
  2. 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;
commented Dec 11, 2012 by Pozzy (140 points)
edited Dec 11, 2012

Thank you for your swift and detailed answer. Email's never straightforward...

...