Hello there,
Verify that your firewall or antivirus software is not blocking the outgoing mail server/SMTP relay. Try turning off your firewall or antivirus software and sending a message. If the message goes through, you need to adjust your firewall or antivirus software's settings.
In Exchange Server, you can create a dedicated Receive connector in the Front End Transport service on a Mailbox server that allows anonymous relay from a specific list of internal network hosts.
Allow anonymous relay on Exchange servers https://learn.microsoft.com/en-us/exchange/mail-flow/connectors/allow-anonymous-relay?view=exchserver-2019
Relay from external application https://techcommunity.microsoft.com/t5/exchange/relay-from-external-application/m-p/3031500
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer–