Sending mail in PHP application using Graph API not working

Jelle Tempelman 21 Reputation points

When trying to send a POST request to "/users/{email}/sendMail" I get an error 403 telling me
"Access is denied. Check credentials and try again."
But my application do have the right permissions (see screenshot)
Same goes the API explorer. It's telling me "You need to consent to permissions on the Modify permissions (preview) tab" but on the preview tab, all the permissions are consented.
What is going wrong?

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
188 questions
Microsoft Graph Applications API
Microsoft Graph Applications API
A Microsoft API that enables you to manage these resources and actions related to applications in Azure Active Directory.
561 questions
Microsoft Graph Explorer API
0 comments No comments
{count} votes

Accepted answer
  1. Michael 17,921 Reputation points

    Hi @Jelle Tempelman ,

    You may misunderstand the delegated permissions and application permissions.

    From the screenshot, your apps are using delegated permissions. And delegated permissions are used by apps that have a signed-in user present.

    If you want you app run without a signed-in user present, you should use application permissions.

    You could refer to this about delegated permissions and application permissions:

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Michael 17,921 Reputation points

    Hi @Jelle Tempelman ,

    Seems like you are trying send emaail from another user. To achieve this, mailbox permissions also need to be granted in exchange online. Please refer to this article for more:


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Jelle Tempelman 21 Reputation points

    Hi @Michael , thanks for responding. I hope we can work this out together, because I'm a bit lost...

    I don't quite understand what you're implying. Under my Azure services -> App registrations I have an application. I'm trying to send email from my PHP web application using the API permissions of this Azure application. I don't understand what you mean with "sending mail from another user". That in my eyes seems a little weird, since my Azure application is not a user nor a mailbox itself, so I have no other choice than sending from "another" user.

    0 comments No comments