EWS Managed API - Email client using POP3/IMAP does not display custom header
We have begun to use the EWS Managed API to send email via MS Exchange Server 2007. We have another product which receives email from MS Exchange Server 2007 via POP3/IMAP protocol.
T开发者_如何学JAVAhe issue we are having when we set custom header using EWS Manged API in C#.NET using code given below. The custom header does not show up.
Also I noticed when I sent the custom header below to myself. And review the headers using Microsoft Outlook I have noticed that the header is visible BUT only in lower case as in "custheader".
Code given below:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials("username", "password", "domain");
service.AutodiscoverUrl("emailaddress@xyz.com");
EmailMessage message = new EmailMessage(service);
message.Subject = "This is a test";
message.Body = "xxxdffsasfasfasfsfsfsfsaffafasfsfsafasfafasffasf";
message.ToRecipients.Add("toaddress@todomain.com");
ExtendedPropertyDefinition msg = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "CUSTHEADER", MapiPropertyType.String);
message.SetExtendedProperty(msg, "87677");
message.SendAndSaveCopy();
Can you help us and let us know how we can workaround this with the EWS Managed API or an alternative solution.
FYI : My colleague ran tests with his own Mail Server (Argo Mail) and Email product which I mentioned above. And we saw that it picks up custom headers as expected when you send them.
This eliminates any possibility that the Email IMAP/POP3 product may be doing something unexpected with the headers. If Outlook Express is not seeing the header, then the Email client mentioned above will definitely not see it either.So, why are these headers not showing to non-MAPI clients? In Outlook, the header does show, but it is a MAPI client.
I noticed that the code used above where we are creating a new extended property. What’s the difference between an extended property, and a named MAPI property (which has been referenced in the http://technet.microsoft.com/en-us/library/bb851492%28EXCHG.80%29.aspx).
Can you answer this question and point me out how we can achieve our custom header being read by our IMAP/POP3 client?
Custom/Modified Headers can be propogated by MS Exchange Server 2007 to Non-Mapi clients using POP/IMAP.
But we need to run the following command: Set-TransportConfig –HeaderPromotionModeSetting [MayCreate | NoCreate | MustCreate]
For E.g.: Set-TransportConfig –HeaderPromotionModeSetting MustCreate
In Exchange management shell use the above cmdlet to change the current behaviour. The default is NoCreate. You can choose either of the other modes.
Preference would be to use MayCreate over MustCreate.
MS Exchange Server 2007 only propogates custom headers in LOWER CASE.
精彩评论