php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

How to connect O365 ?

Open gamersalpha opened this issue 2 years ago • 9 comments

Hello evrybody,

how to connet mailbox to Office 365 From Microsoft

i got evry time this error :

user@web2:/var/www/html/$ php demo_O365.php 
...Start connection O365 ...PHP Fatal error:  Uncaught Exception: IMAP error: Can not authenticate to IMAP server: AUTHENTICATE failed. in /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php:413
Stack trace:
#0 /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php(385): PhpImap\Mailbox->initImapStream()
#1 /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php(324): PhpImap\Mailbox->initImapStreamWithRetry()
#2 /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php(1441): PhpImap\Mailbox->getImapStream()
#3 /var/www/html/demo_phpimap_O365.php(38): PhpImap\Mailbox->imap('check')
#4 {main}
  thrown in /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php on line 413

Fatal error: Uncaught Exception: IMAP error: Can not authenticate to IMAP server: AUTHENTICATE failed. in /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php:413
Stack trace:
#0 /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php(385): PhpImap\Mailbox->initImapStream()
#1 /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php(324): PhpImap\Mailbox->initImapStreamWithRetry()
#2 /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php(1441): PhpImap\Mailbox->getImapStream()
#3 /var/www/html/demo_phpimap_O365.php(38): PhpImap\Mailbox->imap('check')
#4 {main}
  thrown in /var/www/html/vendor/php-imap/php-imap/src/PhpImap/Mailbox.php on line 413
PHP Notice:  Unknown: Can not authenticate to IMAP server: AUTHENTICATE failed. (errflg=2) in Unknown on line 0

Notice: Unknown: Can not authenticate to IMAP server: AUTHENTICATE failed. (errflg=2) in Unknown on line 0

the user and password are good

gamersalpha avatar Oct 10 '22 05:10 gamersalpha

Microsoft disabled your plain authentication.

https://techcommunity.microsoft.com/t5/exchange-team-blog/basic-authentication-and-exchange-online-september-2021-update/ba-p/2772210

derrickbathory avatar Oct 12 '22 15:10 derrickbathory

Hello, thanks,

Microsoft change the game !

All program have to update theyr connector wiht Microsoft connector :/

can phpipam, will get this function ?

thanks

gamersalpha avatar Oct 13 '22 05:10 gamersalpha

This is huge.

Does anybody have a solution that php-imap works again (e.g. with the help of https://github.com/javanile/php-imap2)?

vielhuber avatar Oct 21 '22 10:10 vielhuber

u can contact the support Microsoft on u tenant acess, thay will help u to activate the IMAP on u account with powershel command that's works now for me

just hope Microsoft will not disable this acess forever

thanks

gamersalpha avatar Oct 21 '22 11:10 gamersalpha

O365: "Please understand we will be disabling basic auth for all tenants permanently in January 2023, regardless of their opt-out status." as seen here.

juangacovas avatar Oct 22 '22 06:10 juangacovas

This is huge.

Does anybody have a solution that php-imap works again (e.g. with the help of https://github.com/javanile/php-imap2)?

I renamed all the php_imap functions in this library to php2_imap functions and added the Javanile/php-imap2 library and it does work. Still, that library is very young and it does have some issues, but maybe it fits your needs.

nettunodev avatar Nov 03 '22 10:11 nettunodev

Hello,

Is there any plan or kickstart to support O365 new imap rules on this library?

diegofn avatar Nov 15 '22 12:11 diegofn

Is there any plan or kickstart to support O365 new imap rules on this library?

I would be interested in that too?

kurznet avatar Nov 24 '22 15:11 kurznet

Is there any plan or kickstart to support O365 new imap rules on this library?

I would be interested in that too?

Yes, we need that O365 support can be release as soon as posible.

diegofn avatar Nov 25 '22 14:11 diegofn