I spend some time trying to acheave this goal so I decided to share it with you.
Fists I tried to create a Transport rule following this article.
It does not helped.
So i made some research and found that I can disable Autoreply to recipients outside the organisation in Outlook and OWA with Set-mailbox command:
Set-Mailbox username -ExternalOofOptions InternalOnly
What this does is that it make grayed out the option to set up autoreplay to external organisation in OWA or ECP. But if the Autoreplay is set by the time of this change, it will continue to send Autoreplay messages to external receipents. Autoreplay needs to eb turned off and one again, then the Field for external organisation will be greyed out.
This can be solved by setting the “AllowedOOFType None” for the Default remote domain in EMS
Set-Remotedomain default –AllowedOOFType None
This is disabling the OOF to all external domains.
If you want to disable it only for specific domains, you have to add every domain to remote domains and then put the value to None for each of them