added the logic to retry sending until expiration period