Spectral lines of single molecules in a fluctuating environment