1

i want to read only unread email from outlook exchange server. below is my code. but it is showing all email(read+unread) from inbox.

<?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);
?>

please let me know what can i do. i want to read only unread mail. after reading it should be mark as read.

Thanks in advance.

UnderDog
  • 305
  • 1
  • 4
  • 14
bKashOST
  • 149
  • 4
  • 11
  • 2
    Possible duplicate of [Getting unread mail from exchange web services via PHP](http://stackoverflow.com/questions/6813589/getting-unread-mail-from-exchange-web-services-via-php) – Vishnu Bhadoriya Sep 22 '16 at 07:37

0 Answers0