Automatically change from address

Hello

I have several e-mailaccounts and if I want to send an e-mail to a specific person or domain (company), I need to use a specific from address (it is one of the accounts).
Is there a possibility to make a ‘rule’ for that.
is domain is “abc.com” the from address should be: [email protected] (for example).

Thanks in advance