javanile / php-imap2

PHP IMAP with OAUTH2
https://php-imap2.javanile.org/
GNU General Public License v3.0
48 stars 28 forks source link

example values for imap2_open and outlook.office365.com #23

Closed mpoetzsch closed 1 year ago

mpoetzsch commented 1 year ago

I try to use your lib for connecting to outlook.office365.com with imap2_open(...) but couldnt connect. Do you have managed it, and can you add some examples to docu or here?

francescobianco commented 1 year ago

This is the minimal example for outlook

<?php
$mailbox = '{outlook.office365.com:993/imap/ssl}';
$username = 'sam.sapiol@contoso.onmicrosoft.com';
$accessToken = '...';

$imap = imap2_open($mailbox, $username, $accessToken, OP_XOAUTH2);

the $accessToken is the one you get with a call like this https://github.com/javanile/php-imap-outlook/blob/main/public/index.php#L25

mpoetzsch commented 1 year ago

Thank you! It works like a charm :D :+1: