Whats the issue with this code of sending a message?