简体   繁体   English

如何在Outlook中读取Internet标头和电子邮件

[英]How to read Internet header of and email in outlook

I try to read an email Internet headers that we can view it in email properties in outlook app I ask if there is an option so I can get this I use this code to read the emails in outlook 我尝试读取电子邮件的Internet标头,以便我们可以在Outlook应用程序的电子邮件属性中查看它,请问是否有一个选项,以便我可以使用此代码在Outlook中读取电子邮件

  Outlook::Application outlook;
  if (!outlook.isNull())
  {
  Outlook::NameSpace session(outlook.Session());
  session.Logon();
  Outlook::MAPIFolder *folder = session.GetDefaultFolder(Outlook::olFolderInbox);

  Outlook::Items* mails = new Outlook::Items(folder->Items());
  mails->Sort("ReceivedTime");
  int num = mails->Count();
  ui->label->setText(QString("I have %1 of messages").arg(QString::number(num)));

  // Indexing starts from 1
  for (int i = 1; i < num; i++)
  {
  Outlook::MailItem mail(mails->Item(i));
  QString s = mail.Subject(); // do something with subject
  QString b = mail.Body(); // do something with body
  ui->plainTextEdit->appendPlainText("subject : \n" + s);
  ui->plainTextEdit->appendPlainText("Body : " + b);
  ui->plainTextEdit->appendPlainText("-----------------------------------------------");
  }
  }

and I was check the Outlook::MailItem for a function to get this Internet header but I not found so if any one try it before or have any idea to solve this Thanks in advance 并且我正在检查Outlook :: MailItem中是否有一个函数来获取此Internet标头,但我没有找到,所以如果有人以前尝试过它或有任何想法解决此问题,请先谢谢

You can access the Internet headers via the PR_TRANSPORT_MESSAGE_HEADERS_W property. 您可以通过PR_TRANSPORT_MESSAGE_HEADERS_W属性访问Internet标头。 That property and other MAPI properties are retrievable via the PropertyAccessor object. 该属性和其他MAPI属性可通过PropertyAccessor对象检索。 Note though that individual x-headers are not accessible via a named MAPI property, they are bundled within the message headers so you'll need to parse every line of text to find any particular header record. 请注意,尽管无法通过命名的MAPI属性访问各个x标题,但它们捆绑在消息标题中,因此您需要解析每一行文本以查找任何特定的标题记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM