Hi @Banter Software ,
To achieve your requirement you can use below two approaches.
Approach 1:
To send messages from another user using Graph API, configure application token with mail.send permission and needs to be consented by an administrator as mentioned here https://learn.microsoft.com/en-us/graph/outlook-send-mail-from-other-user
We will be able to send email as any other user in the organization by sending the mail normally through the user's mailbox with application permission using the below endpoint
POST https://graph.microsoft.com/v1.0/users/{userId}/sendMail.
Approach 2:
In order to send messages from another user using Graph Explorer(delegated permission), two type of permissions are required such as Microsoft graph permissions and mailbox permissions.
Use Mail.send.Shared graph permission as delegated.
We have two types of mailbox permissions, send on Behalf and Send As and we can configure these permissions as mentioned here https://learn.microsoft.com/en-us/microsoft-365/admin/add-users/give-mailbox-permissions-to-another-user?view=o365-worldwide.
The user who logged in to your application with the Mail.Send.Shared permission MUST have at least one of these permissions
- Send on Behalf
- Send As granted to the mailbox, group, or distribution list that the mail is from. Also need to set from address to the mailbox address in which the permissions are granted.
Reference example below: POST https://graph.microsoft.com/v1.0/me/sendMail.
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "xxxxxx.onmicrosoft.com"
}
}
],
"from": {
"emailAddress": {
"address": "xxxxxx.onmicrosoft.com"
}
}
}
}
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".