Ultrasonic pest deterrent that apparently thinks you're the one that needs repelled.
Seriously though, they're marketed as being inaudible to humans, but my neighbor has a similar one that's supposed to drive away moles and I can easily hear it.
Maybe you can set it up in such a way that the mailman doesn’t get sprayed? Idk your yard.
There are Ultra Sonic variations too.