1

场景:我试图从远程 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;
4

0 回答 0