Prosecutors say Mohamud unwittingly unveiled his plan to undercover officers by e-mail several months ago , while believing he was contacting an accomplice in Pakistan .