0

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

  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

4

1 回答 1

2

您可以通过 PR_TRANSPORT_MESSAGE_HEADERS_W 属性访问 Internet 标头。该属性和其他 MAPI 属性可通过PropertyAccessor对象检索。请注意,虽然单个 x-headers 无法通过命名的 MAPI 属性访问,但它们捆绑在邮件标头中,因此您需要解析每一行文本以查找任何特定的标头记录。

于 2017-03-11T23:18:37.520 回答