We characterize the molecular environment of candidate massive young stellar objects (MYSOs) signposted by methanol masers. Single pixel observations of 10 transitions of HCO^+, CO and CS isotopomers were carried out, using the IRAM 30m telescope. We studied a sample of 28 targets for which the 6.7GHz maser emission positions are known with a sub-arcsecond accuracy. The systemic velocity inferred from the optically thin lines agrees within 3km/s with the central velocity of the maser emission for most of the sources. About 64% of the sources show line wings in one or more transitions of CO, HCO^+ and CS species, indicating the presence of molecular outflows. Comparison of the widths of line wings and methanol maser emission suggests that the 6.7GHz maser line traces the environment of MYSO of various kinematic regimes. Therefore conditions conducive for the methanol maser can exist in the inner parts of molecular clouds or circumstellar discs as well as in the outer parts associated with molecular outflows. Calculations of the physical conditions based on the CO and HCO^+ lines and the CS line intensity ratios refine the input parameters for maser models.