Recent chemical studies of high-mass star-forming regions at submillimeter and infrared wavelengths reveal large variations in the abundances depending on evolutionary state. Such variations can be explained by freezing out of molecules onto grains in the cold collapse phase, followed by evaporation and high-temperature chemical reactions when the young star heats the envelope. Thus, the chemical composition can be a powerful diagnostic tool. A detailed study of a set of infrared-bright massive young stars reveals systematic increases in the gas/solid ratios and abundances of evaporated molecules with temperature. This ‘global heating’ plausibly results from the gradual dispersion of the envelopes. We argue that these objects form the earliest phase of massive star formation, before the ‘hot core’ and ultracompact H II region phase.