Hello again
The following is my humble thought.
What I'd like to say at first is:
"While I was writing an e-mail", when it comes before the main clause, modifies wholeof the main clause "I noticed I misspelled some words". More specifically, the while-clause modifies the main statement "I noticed". On the other hand, in the case of "I noticed I misspelled some words when I was writing an e-mail", the syntactic status of the while-clause is ambiguous. The sentence could be interpreted both as "(I noticed) (I misspelled some words when I was writing an e-mail)" and as "(I noticed I misspelled some words) (when I was writing an e-mail)".
As for the choice between "I misspelled" and "I had misspelled", "I had misspelled" is scientifically more correct, because the event "I misspell" clearly should happen in a time prior to the time the event "I notice it" happens. But because of this very unobjectionable relation in time sequence of the two events, the use of "I had misspelled" sounds a bit too much correct when it is spoken in everyday speech.
paco