add function to return envelope size for the use of persistent message