Spam isn't 'illegal' ingame, it is just annoying / a nuisance, spams up the chat log, and consistent occurrences of it can generally lead to the player having action taken against them.
On the forums, the same thing happens, except with the happening of creating multiple useless threads (aka thread spamming) and then 'useless posts'.