To send to a specific channel -
http://wowpedia.org/API_SendChatMessage
In the example posted on the page
Code:
SendChatMessage("Hello Bob!", "WHISPER", 7, "Bob")
"Hello Bob!" is the message
"WHISPER" is the channel and with whispers you need to provide the 4th parameter "Bob"
7 is the language type, if you don't want any specific language you can set that to nil
"Bob" is the 4th parameter and only needed when using whispers
The only 2 parameters needed to be set when sending to channels are the message and channel, the rest you can ignore.
For example using zork's example to tell you what was casted..
Code:
print("|cffffff9a[NoTroll]|r", name, "used", spellName)
To send a message to a channel you would do
Code:
SendChatMessage("|cffffff9a[NoTroll]|r "..name.." used "..spellName, "SAY")