outlook365:电子邮件标记为已读/未读不与使用PHP + Laravel的imap库一起使用

For imap I have used below library with laravel ,

"php-imap/php-imap": "3.0.*",

my code is as below,

$stream = '{' . $email['email_server'] . ":993/imap/ssl}";

$con =  new \PhpImap\Mailbox($stream ."INBOX", $email['email_user'], $email['email_password']);

//to mark an email as read

$con->setFlag([EMAIL_MESSAGE_NO], '\Seen');

//to mark an email as unread

$con->clearFlag([EMAIL_MESSAGE_NO], '\Seen');

It is working with outlook account properly, but for an outlook365 account, it is not working.

Is there any other setting is required or needs to change in my code level?

Please help me to resolve it out. Thank you.

I will appreciate the answer which will be helpful to me.