implement the send message function.