Can I send mail on behalf of user using graph API with App only permissions

Naga Dheeraj M 20 Reputation points
2024-03-11T11:49:11.2833333+00:00

Can I send mail on behalf of user using graph API with App only permissions?

I get this error.

{
    "error": {
        "code": "ErrorAccessDenied",
        "message": "Access is denied. Check credentials and try again."
    }
}
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Achraf Ben Alaya 1,311 Reputation points MVP
    2024-03-11T12:32:03.0666667+00:00

    Hi ,

    Yes, you can utilize the Microsoft Graph API with Application permissions to send mail on behalf of a user.

    Please check : https://learn.microsoft.com/en-us/graph/auth-v2-user?%3Fwt.mc_id=MVP_328341&tabs=http

    I hope you found this helpful.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,376 Reputation points
    2024-03-12T03:11:27.3533333+00:00

    Hi @Naga Dheeraj M

    Yes, you can certainly use application permissions to send messages on behalf of other users.

    First, you need to make sure you have granted the Mail.Send application permission to the calling app and granted administrator consent for that permission. Next, you need to request an access token using the daemon-based client credentials flow and call the POST /users/{id}/sendMail endpoint (note, not the POST /me/sendMail endpoint).

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.