updated sample21 with new sendEnvelop logic