Office 365 does not allow sending mail with a sender other than the configured mail

I have configured the magazine correctly and the mail server works to reset the password, etc.

Example:
smtp = On

smtp_server = smtp.office365.com
smtp_port = 587
smtp_auth = tls
smtp_username = sender@ojs.com
smtp_password = pasword

But in the options that the from is different from “sender@ojs.com”, as when they have to suar as from the mail of the main contact “contact@ojs.com” the messages do not arrive.

the errore message of the web server is the following:

SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: STOREDRV.Submission.Exception: SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Can not submit message.

Any solution?

Thank you

This is an issue in progress here:
https://github.com/pkp/pkp-lib/issues/4164