Consider a right triangle whose horizontal leg runs from one of the vertices of the square base to the center of the base (it's length is half the diagonal of the square base), the vertical leg runs from the center of the base to the vertex of the pyramid (the altitude of the pyramid) and the hypotenuse is the edge of length e.

So, you know the horizontal leg and the hypotenuse in terms of m, you may find the altitude using the Pythagorean theorem.