Force mail to route via smtp relay for segment of population

We have two servers in our environment, for the sake of this we’ll call them ServerA and ServerB, that host a group of imap accounts. The accounts belong to the same organization in the Domino Directory and have the same internet domain for their internet addresses. What we need in our environment is, for any mail user that sends mail to any account that resides on ServerA or ServerB, for the messages to route through an smtp relay instead of routing directly to the Domino. How can this be accomplished?