The command m365 outlook mail send does not support app only permissions. It can only be used in delegated mode.
It can also not be used to send mail from a shared mailbox.
This issue is about adding extra options to overcome these limitations.
| Option |
Description |
--sender [sender] |
The upn or user id of the account that sends the email. Defaults to the signed in user. |
-m, --mailbox [mailbox] |
An optional e-mailaddress that the sender uses to send the email. For example a shared mailbox, group or distribution list. The sender needs to be a delegate on this mailbox. |
Remarks
If you are connected using app only authentication:
- Specify a user id or UPN in the
--sender option. You need Mail.Send application permissions on the Microsoft Graph to be able to do this. The email will be sent as if it came from the specified user, and can optionally be saved in the sent folder of that user account.
- You can optionally also specify the
--mailbox option to send mail on behalf of a shared mailbox, group or distribution list.
If you are connected with a regular user account:
- Specify the
--mailbox option if you want to send an email on behalf of another mailbox. This can be a shared mailbox, group or distribution list. It will be visible in the email that the email was sent by the signed in user, on behalf of the specified mailbox. You need to be assigned delegate permissions on the mailbox to be able to do this.
- You can specify the
--sender option if you have full control permissions on the mailbox of another user. The email will be sent as if it came from the specified user, and can optionally be saved in the sent folder of that user account.
Examples
Send an email on behalf of a shared mailbox using the signed in user
Send an email as another user
Additional Info
Instead of the /me endpoint, we'd need the following: /users/{id | userPrincipalName}/sendMail when using the --sender option.
More info:
https://docs.microsoft.com/en-us/graph/api/user-sendmail
https://docs.microsoft.com/en-us/graph/outlook-send-mail-from-other-user
When using app only authentication, the command should throw an error if the --sender is not specified.
The command
m365 outlook mail senddoes not support app only permissions. It can only be used in delegated mode.It can also not be used to send mail from a shared mailbox.
This issue is about adding extra options to overcome these limitations.
--sender [sender]-m, --mailbox [mailbox]Remarks
If you are connected using app only authentication:
--senderoption. You needMail.Sendapplication permissions on the Microsoft Graph to be able to do this. The email will be sent as if it came from the specified user, and can optionally be saved in the sent folder of that user account.--mailboxoption to send mail on behalf of a shared mailbox, group or distribution list.If you are connected with a regular user account:
--mailboxoption if you want to send an email on behalf of another mailbox. This can be a shared mailbox, group or distribution list. It will be visible in the email that the email was sent by the signed in user, on behalf of the specified mailbox. You need to be assigned delegate permissions on the mailbox to be able to do this.--senderoption if you have full control permissions on the mailbox of another user. The email will be sent as if it came from the specified user, and can optionally be saved in the sent folder of that user account.Examples
Send an email on behalf of a shared mailbox using the signed in user
Send an email as another user
Additional Info
Instead of the
/meendpoint, we'd need the following:/users/{id | userPrincipalName}/sendMailwhen using the--senderoption.More info:
https://docs.microsoft.com/en-us/graph/api/user-sendmail
https://docs.microsoft.com/en-us/graph/outlook-send-mail-from-other-user
When using app only authentication, the command should throw an error if the
--senderis not specified.