The title of this idea is a setting in the mail app from Apple.
It will choose the right account to send email from based on different factors.
I'm not sure how the algorithm they chose works but it seems that there are some quick wins:
1. If I'm sending an email to @example.com and I have an @example.com address it will automatically pick that one. That includes gmail.
2. It looks at history and sees what account is most often used to send emails to different accounts in my address book. It doesn't even have to be that complicated, it could just chose the last one!
I think that this would save a lot of frustrations where you sent an email from the wrong account.