I once had to do a team project with another student who did all his coding in Wordpad, god knows why. His indentation was more or less random. I wanted to murder him.
It happens if you paste the code into an Outlook email (which used Word as the rendering engine IIRC)
Emailed code snippets have this problem when emailed using some email clients (Outlook, looking at you)