3

I have been attempting to get email's from office 365 using PHP. Here i need to get email's without user login.So i'm trying to get access token without user login.

This is the end point where i'm getting access token.

https://login.microsoftonline.com/common/oauth2/v2.0/token

It's a POST request using following key param values

client_id     xxxxxx
scope         https://graph.microsoft.com/.default
client_secret xxxxxx
grant_type    client_credentials

Then i'm getting response as

{
    "token_type": "Bearer",
    "expires_in": 3599,
    "ext_expires_in": 0,
    "access_token": "xxxxxxxxRiNDcvIiwiaWF0IjoxNTMzMDYwMjA2LCJuYmYiOxxxxx"
}

After that i don't know which api to use to get email's from mail box using access token.Thank you in advance.

dhamo dharan
  • 712
  • 1
  • 10
  • 25
  • You can always just use good old IMAP, see [imap_open()](http://www.php.net/imap_open). – Havenard Jul 31 '18 at 18:33
  • `imap_open('{outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX', 'login', 'passwd')` – Havenard Jul 31 '18 at 18:35
  • it's possible to get email's from imap_open then parse it to store in DB. – dhamo dharan Jul 31 '18 at 18:38
  • Of course it is, the only thing IMAP can't do are Exchange features, like synchronizing contacts or modifying recipient rules. Everything related to the emails works. – Havenard Aug 01 '18 at 00:24

0 Answers0