Implemented new sendMessage core function.