A quaternionic wavefunction consisting of real and scalar functions is found to satisfy the quaternionic momentum eigenvalue equation. Each of these components are found to satisfy a generalized wave equation of the form \(\frac{1}{c^2}\frac{\partial^2\psi_0}{\partial t^2} - \nabla^2\psi_0+2(\frac{m_0}{\hbar})\frac{\partial\psi_0}{\partial t}+(\frac{m_0c}{\hbar})^2\psi_0=0\). This reduces to the massless Klein-Gordon equation, if we replace \(\frac{\partial}{\partial t}\to\frac{\partial}{\partial t}+\frac{m_0c^2}{\hbar}\). For a plane wave solution the angular frequency is complex and is given by \(\vec{\omega}_\pm=i\frac{m_0c^2}{\hbar}\pm c\vec{k} \), where \(\vec{k}\) is the propagation constant vector. This equation is in agreement with the Einstein energy-momentum formula. The spin of the particle is obtained from the interaction of the particle with the photon field.