Nugatory said:
You are wrong. E=mc^2 only applies to objects with non-zero rest mass and photons have a zero rest mass. The equation that you're looking for is E^2=(mc^2)^2 + (pc)^2 where p is the momentum and m is the rest mass; this one works even if the rest mass is zero, as it is for a photon.
even though it is deprecated in most, nearly all, current texts, there is most certainly a usage to the famous E=mc^2 where the m refers to the (oft deprecated) "relativistic mass":
m = \frac{m_0}{\sqrt{1 - \frac{v^2}{c^2}}}
and m_0 is the "rest mass" or "invariant mass" of the body. a photon is assumed to move at a speed of c in anyone's frame of reference, so it cannot have a non-zero rest mass because
m_0 = m \sqrt{1 - \frac{v^2}{c^2}}
and the latter factor goes to zero when v=c.
if m used in E=mc^2 is the expression above, then E=mc^2 is perfectly consistent with
E^2=(m_0 c^2)^2 + (p c)^2
and
p = m v .
this E is the
total energy, the "rest energy" E_0=m_0 c^2 (which is the "E=mc^2" you're referring to) plus the kinetic energy (from the POV of the observer in the frame of reference).
E = m c^2 = E_0 + T
the kinetic energy
T = E - E_0
goes to the classical approximation T = \frac{1}{2}m_0 v^2 when v<<c.
This equation allows the photon to carry momentum, which is transferred to the sail when the photon hits it.
a quantity of the dimension "mass" can be derived from dividing the momentum of the photon by its speed (which is c).
"wrong" and "currently deprecated" are not the same thing.