Exchange server 使用带有PKI身份验证的Microsoft Exchange Server API解密电子邮件正文。

Exchange server 使用带有PKI身份验证的Microsoft Exchange Server API解密电子邮件正文。,exchange-server,Exchange Server,场景:我尝试从远程Exchange服务器提取电子邮件,并尝试显示诸如发件人、收件人、正文、时间等详细信息。只有在邮件未加密的情况下,我才能在此处显示上述详细信息。如果邮件已加密,我可以访问除电子邮件正文以外的所有详细信息。电子邮件正文为空。因此,请帮助我如何使用任何一种解密技术解密邮件并获取邮件正文(最好使用PKI身份验证) 我使用以下代码获取电子邮件项目 ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2007

场景:我尝试从远程Exchange服务器提取电子邮件,并尝试显示诸如发件人、收件人、正文、时间等详细信息。只有在邮件未加密的情况下,我才能在此处显示上述详细信息。如果邮件已加密,我可以访问除电子邮件正文以外的所有详细信息。电子邮件正文为空。因此,请帮助我如何使用任何一种解密技术解密邮件并获取邮件正文(最好使用PKI身份验证)

我使用以下代码获取电子邮件项目

ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2007_SP1)
            {
                Credentials = new WebCredentials("username", "password")

            };

            ews.AutodiscoverUrl("firstname.lastname@company.com",RedirectionUrlValidationCallback);
            object o = ews.FindItems(WellKnownFolderName.Inbox, new ItemView(10));
            FindItemsResults<Item> findResults = ews.FindItems(WellKnownFolderName.Inbox, new ItemView(10));


            foreach (EmailMessage message  in findResults.Items.Take(10))
            {
                //MailMessage smtpmsg = message as MailMessage;
                mails.Rows.Add(message.Id.UniqueId, message.From.Name, message.Subject, message.DateTimeSent);


            }


To display the body am using the following code : 

                PropertySet emailPropSet = new PropertySet();                                 emailPropSet.RequestedBodyType = BodyType.Text;                emailPropSet.BasePropertySet = BasePropertySet.FirstClassProperties;       EmailMessage message = EmailMessage.Bind(ews, new ItemId(uniqueId), emailPropSet);

  message.Load();

lblFrom.Text = message.From.ToString();

                lblSubject.Text = message.Subject;

               lblBody.Text = message.Body.Text;
ExchangeService ews=新的ExchangeService(ExchangeVersion.Exchange2007\u SP1)
{
凭据=新的WebCredentials(“用户名”、“密码”)
};
ews.AutodiscoverUrl(“firstname。lastname@company.com,重定向UrlValidationCallback);
对象o=ews.FindItems(WellKnownFolderName.Inbox,新项目视图(10));
FindItemsResults findResults=ews.FindItems(WellKnownFolderName.Inbox,新项目视图(10));
foreach(findResults.Items.Take中的EmailMessage消息(10))
{
//MailMessage smtpmsg=作为MailMessage的消息;
mails.Rows.Add(message.Id.UniqueId、message.From.Name、message.Subject、message.DateTimeSent);
}
要使用以下代码显示车身am:
PropertySet emailPropSet=新的PropertySet();emailPropSet.RequestedBodyType=BodyType.Text;emailPropSet.BasePropertySet=BasePropertySet.FirstClassProperties;EmailMessage=EmailMessage.Bind(ews,新项目ID(uniqueId),emailPropSet);
message.Load();
lblFrom.Text=message.From.ToString();
lblSubject.Text=message.Subject;
lblBody.Text=message.Body.Text;

我或多或少面临着同样的挑战,无法相信在5年内没有关于如何简单地解密电子邮件的评论或答案,尤其是在您拥有pfx文件的情况下。