  CONTEXT: The chemistry in the inner few thousand AU of accreting envelopes
around young stellar objects is predicted to vary greatly with far-UV and X-ray
irradiation by the central star. Aim We search for molecular tracers of
high-energy irradiation by the protostar in the hot inner envelope. METHODS:
The Submillimeter Array (SMA) has observed the high-mass star forming region
AFGL 2591 in lines of CS, SO, HCN, HCN(v2=1), and HC15N with 0.6" resolution at
350 GHz probing radial scales of 600-3500 AU for an assumed distance of 1 kpc.
The SMA observations are compared with the predictions of a chemical model
fitted to previous single-dish observations. RESULTS: The CS and SO main peaks
are extended in space at the FWHM level, as predicted in the model assuming
protostellar X-rays. However, the main peak sizes are found smaller than
modeled by nearly a factor of 2. On the other hand, the lines of CS, HCN, and
HC15N, but not SO and HCN(v2=1), show pedestal emissions at radii of about 3500
AU that are not predicted. All lines except SO show a secondary peak within the
approaching outflow cone. A dip or null in the visibilities caused by a sharp
decrease in abundance with increasing radius is not observed in CS and only
tentatively in SO. CONCLUSIONS: The emission of protostellar X-rays is
supported by the good fit of the modeled SO and CS amplitude visibilities
including an extended main peak in CS. The broad pedestals can be interpreted
by far-UV irradiation in a spherically non-symmetric geometry, possibly
comprising outflow walls on scales of 3500 -- 7000 AU. The extended CS and SO
main peaks suggest sulfur evaporation near the 100 K temperature radius.
