Use this Exchange Management Shell command to allow anonymous relay to external domains. (This should not be done on external facing servers.)
Get-ReceiveConnector "<servername>\Receive Connector Name" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "Ms-Exch-Accept-Headers-Routing","Ms-Exch-SMTP-Accept-Any-Sender","Ms-Exch-SMTP-Accept-Authoritative-Domain-Sender","Ms-Exch-SMTP-Submit","Ms-Exch-SMTP-Accept-Any-Recipient"
The last ExtendedRights permission is the one that can only be set through the shell. (The other permissions can be set in the GUI console.)