Is there any way to automatically set outgoing email address based on recipient's email or domain in mail.app?
Unfortunately, there is no way to do this in Apple Mail. It only works for messages which you are replying to (they automatically use the same outgoing address which received the original message). There is no hook in AppleScript, nor an option in Automator by which to make this happen. If it were possible, as of right now, it would still require a third-party plugin, which I have not been able to find either. So unfortunately, the answer is now.

Note: Also, if you select the inbox of the account from which you want to send the message, then compose, Mail will automatically use that account's email address for sending, unless you change it. Not quite as helpful as what you were hoping for, but at least something worth considering.

Good luck and happy mailing!