Azure Microsoft Graph API - How to set From mail address which is not having Mail.Send permission.

shmhs 1 Reputation point
2021-06-08T17:15:19.163+00:00

The scenario here is we have a 'domain and mailbox' enabled service account (foocompany) and registered Azure AD application with Mail.Send permission. So, when we are sending mail, the From mail is as foo@mathieu.company .com

but the scenario here is to send mail on behalf of different account i.e from (bar@mathieu.company .com), I hardcoded this but this didn't work.

How can this be achieved , using MS Graph mail.send API? Is there any workaround or hack for this? Attached image for basic reference.

103538-foo.png

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,570 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,865 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,455 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 95,181 Reputation points MVP
    2021-06-08T17:31:08.377+00:00

    You can grant Send As/Send on behalf permissions (so that the mailbox you are authenticating as, foo@keyman .com, can send on behalf of bar@keyman .com). You can use the Microsoft 365 Admin Center, the Exchange Admin Center or PowerShell to grant the permissions, let me know if you need more details.

    If you want to rely on the Graph API completely, you can grant the Mail.Send application permission, which allows you to impersonate (send on behalf of) every user in the organization.