Why do you want to do it that way? Since you said "Solution by Fourier series" why not write it out as a Fourier series?

u(x,t)= \sum_{n=0}^\infty A_n(t) cos(nx)

(The boundary conditions set the derivative to 0 at 0 and \pi and sines do not satisfy that so I know the Fourier series can be written in terms of cosine only. Essentially, this is the same as assuming u is symmetric about the origin.)

u_{t}= \sum_{n=0}^\infty A_n' cos(nx)

u_xx= \sum_{n=0}^\infty -n^2A_n cos(nx).

Expand e^{-t} (aconstantwith respect to x) in a cosine series and the equation becomes an system of equations for A_n(t).