$E$ = $mc^2$
A much better expression is $E^2 = (mc^2)^2 + (pc)^2$, where $m$ is the "mass" (also known as "intrinsic mass", also known "rest mass", but most physicists nowadays just use "mass") of the particle and $p$ is the particle's momentum. This reduces to $E=mc^2$ in the special case of a particle with zero momentum, but it also reduces to $E=pc$ in the case of a particle such as a photon with zero mass.
Using $E=mc^2$ as a general expression implies a rather different concept of mass, that of relativistic mass. Many physicists did indeed use the concept of relativistic mass early on in the development of relativity theory. At least initially, even Einstein was in that camp. Most of those physicists, Einstein included, abandoned that concept for the concept of "rest mass. " There are just too many problems with the concept of relativistic mass. The concept of "rest mass" (or "intrinsic mass" or just "mass") makes much more sense than does the concept of relativistic mass.
Note that the term "rest mass" is a bit contradictory for massless particles such as photons. There is no frame in which a photon is at rest. This apparent contradiction vanishes if you use the phrase "intrinsic mass" (or just "mass") in lieu of "rest mass."
There are a few hangers-on amongst professional physicists who still prefer the concept of relativistic mass over rest mass. These physicists are now few and far between. Eventually they'll die, and the concept of relativistic mass will eventually die with them.