only mark a message as sent if no error occurs