You might also want to take a look at the email library from Python 2.2.3. I am using it to generate emails, can also be used to parse emails.
Hope this helps.