You don't have to use code to do this, but it does require some setup.
We use the same type of layout, we have multiple emails to different groups, and each groups can have the an email that is the same as another group.
The way that we solved the problem was by having a Sharepoint list with the name of the group and an email associated with that group. (This allows you to change the email of the group without changing your form)
Within the Infopath form, there is a textbox associated with each group, we have Infopath load the email address from the Sharepoint list for each group on form load.
We use a textbox called EmailList that contains the concatenation of the emails that we need to send to.
When we email, the button used has a rule for each textbox, it checks the email textbox to see if that email exists in the EmailList textbox, if not, add it to the list.
I attached an example of it. (The EmailList textbox part).
You should be able to make it work for your needs, if you choose to use this way.