the order number comes from the Store Order Summary server behavior. If the Universal Email server behavior comes before the store order summary server behavior, the order number will not be created yet.
double check the order of the server behaviors on the confirm.php page. You may need to move the universal Email code so that it is after the store order summary code.