# Mass and frequency of photons [duplicate]

Light is affected by gravity which means light has got mass. Quantum theory tells us that light consists of discrete quanta of energy, which we call photons. These photons have a rest mass of zero (as a consequence of special relativity), but a "moving photon" (I don't know whether that notion is stupid) has got some mass.
According to Planck, a photon travelling with a frequency ϑ will be associated with an energy
$$E=hϑ.$$
Since the same photon is travelling at the speed of light, it should hold valid for relativity also. In relativistic theory, the energy of a photon is given by
$$E=pc$$ for a photon $p=mc$ where $m$ is the relativistic mass of the photon. Hence $E=mc^2$
Comparing both equations, $$hϑ=mc^2$$ or
$$m=hϑ/c^2$$ which means the mass of a photon is dependent on its frequency. This is the cause of redshift of light in a gravitational field. But how frequency account for mass? Is it a direct evidence that light and matter are not distinct entities of the universe, but matter is nothing but condensed energy?