Hi JoshJoseph,
Thank you for the posting in Microsoft Community. Based on your case description, we will try our best for helping from our side.
Regarding this error, at once we suggest you to try to configure “Office 365 SMTP relay” method. Here is the detailed steps information article: https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-office-3, kindly refer option 3 under this mentioned article.
If the issue still persist, since you are using java program or code to operate such action for Outlook, so we recommend you that kindly post your question in Microsoft Office developer community, because this is our dedicated support team for this program or code related concern or question, our dedicated support team will further guide you regarding your concern.
We are truly appreciating your cooperation in our forum community.
Regards,
Darpan