The problem was that my message did not have the right syntax. When using telnet I was passing \r at the end, when I hit return it added the \n which is what the server needed. In Perl I only passed the \r. Since no \n was added, and no return key entered in my keyboard, the server was simply refusing the message.
Thank you to those that helped me!