Exim4 send using smarthost, if smarthost down then send directly.
How can I achieve that?
The way I'd do this would be to write a script that detected whether or not the smarthost was up or down, and returned 0 or 1 accordingly. Then you could configure your router with the following:
If the smarthost is up If the smarthost is down, the router condition will fail, and Exim will jump down to the next router until it finds the direct SMTP router.