1

Outlook Exchange サーバーからの未読メールだけを読みたいです。以下は私のコードです。しかし、受信トレイからのすべてのメール(既読+未読)が表示されています。

<?php
require_once ('../mail3/php-ews-master/ExchangeWebServices.php');
require_once ('../mail3/php-ews-master/EWS_Exception.php');
require_once ('../mail3/php-ews-master/EWSType.php');
require_once ('../mail3/php-ews-master/NTLMSoapClient.php');

function __autoload($class_name)
{
// Start from the base path and determine the location from the class name,
$base_path = '../mail3/php-ews-master';
$include_file = $base_path . '/' . str_replace('_', '/', $class_name) . '.php';

return (file_exists($include_file) ? require_once $include_file : false);
}

//$message_id = ''; // Id of the email message
$ews = new ExchangeWebServices("webmail.bangla.com", "dd.test",  "************",ExchangeWebServices::VERSION_2010);

$request = new EWSType_FindItemType();
$request->ItemShape = new EWSType_ItemResponseShapeType();
$request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;

$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new  EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;

$request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;

$result = $ews->FindItem($request);
var_dump($result);
?>

私に何ができるか教えてください。未読メールだけ読みたい。読んだ後は、既読としてマークする必要があります。

前もって感謝します。

4

0 に答える 0