This is a small AddOn that sends a custom chat message every time you mouseover a unit. You can send the message to any chat type (e.g. SAY, PARTY, YELL, etc.) and target (player name for WHISPER or channel number for CHANNEL).
You can disable chat messages when mousing over an NPC if you only want to send messages when you mouseover a player (the default is to send messages for both).
Use /moc or /mouseoverchat in-game to see how to configure the AddOn.
Thanks to dont of Wow Interface for suggesting this AddOn here (I can't yet link directly to the comment unfortunately).