我们已开始使用 EWS 托管 API 通过 MS Exchange Server 2007 发送电子邮件。
我们还有另一种产品,它通过 POP3/IMAP 协议从 MS Exchange Server 2007 接收电子邮件。
当我们使用下面给出的代码在 C#.NET 中使用 EWS Manged API 设置自定义标头时遇到的问题。
自定义标头不显示。
当我将下面的自定义标头发送给自己时,我也注意到了。并使用 Microsoft Outlook 查看标题,我注意到标题是可见的,但仅以小写形式显示,如“custheader”。
代码如下:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials("username", "password", "domain");
service.AutodiscoverUrl("[email protected]");
EmailMessage message = new EmailMessage(service);
message.Subject = "This is a test";
message.Body = "xxxdffsasfasfasfsfsfsfsaffafasfsfsafasfafasffasf";
message.ToRecipients.Add("[email protected]");
ExtendedPropertyDefinition msg = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "CUSTHEADER", MapiPropertyType.String);
message.SetExtendedProperty(msg, "87677");
message.SendAndSaveCopy();
您能否帮助我们并让我们知道如何使用 EWS 托管 API 或替代解决方案解决此问题。
仅供参考:我的同事使用他自己的邮件服务器(Argo Mail)和我上面提到的电子邮件产品进行了测试。我们看到,当您发送自定义标头时,它会按预期拾取自定义标头。
这消除了电子邮件 IMAP/POP3 产品可能对标头执行意外操作的任何可能性。如果 Outlook Express 没有看到标题,那么上面提到的电子邮件客户端也肯定不会看到它。
那么,为什么这些标头不向非 MAPI 客户端显示呢?在 Outlook 中,标题确实会显示,但它是 MAPI 客户端。
我注意到上面使用的代码我们正在创建一个新的扩展属性。扩展属性和命名 MAPI 属性(已在 http://technet.microsoft.com/en-us/library/bb851492%28EXCHG.80%29.aspx)。
您能否回答这个问题并指出我们如何实现 IMAP/POP3 客户端读取自定义标头?
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.
The 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("[email protected]");
EmailMessage message = new EmailMessage(service);
message.Subject = "This is a test";
message.Body = "xxxdffsasfasfasfsfsfsfsaffafasfsfsafasfafasffasf";
message.ToRecipients.Add("[email protected]");
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?
发布评论
评论(1)
MS Exchange Server 2007 可以使用 POP/IMAP 将自定义/修改的标头传播到非 Mapi 客户端。
但我们需要运行以下命令:Set-TransportConfig –HeaderPromotionModeSetting [MayCreate |没有创建 |必须创建]
例如:Set-TransportConfig –HeaderPromotionModeSetting MustCreate
在 Exchange 管理 shell 中使用上述 cmdlet 更改当前行为。默认为NoCreate。您可以选择其他模式之一。
优先使用 MayCreate 而不是 MustCreate。
MS Exchange Server 2007 仅以小写形式传播自定义标头。
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.