php-ews
php-ews copied to clipboard
get liste with primarySmtpAddress
Hello, I'm a beginner and i want to get the items of my reception box in using primarySmtpAddress.
i do this :
require_once "vendor/autoload.php";
$host = 'mail.myhost.com';
$username = 'myusername';
$password = 'my password';
$email = '[email protected]';
$api = \garethp\ews\MailAPI::withUsernameAndPassword(
$host,
$username,
$password,
[
'primarySmtpEmailAddress' => $email
]
);
$box = $api->getFolderByDistinguishedId('inbox');
echo "</br>Tot : ".$box->getTotalCount();
$mail = $api->getMailItems();
and I get:
Tot : 7
Fatal error: Uncaught garethp\ews\API\Exception\ExchangeException: When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids. in /Applications/MAMP/htdocs/ews_gareth/vendor/garethp/php-ews/src/API/ExchangeWebServices.php:417 Stack trace: #0 /Applications/MAMP/htdocs/ews_gareth/vendor/garethp/php-
thanks for your help
Hi.
I'll look in to this. I may request more information to help fix this. What version are you using?