As far as I know GRAPH API allows you to set the sender address and the from address - see https://learn.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0
To send as a shared mailbox you can use something like this:
POST https://graph.microsoft.com/v1.0/users/******@contoso.com/sendMail