email module in 2.2

Alex Russell alex at securepipe.com
Sat May 25 23:43:41 EDT 2002


Matthew Dixon Cowles wrote:

> You're very welcome. That code doesn't do anything in particular with
> multipart/alternative messages primarily because you didn't mention
> that it needed to <wink>.

Fair enough =)

> Of course you may be right but I'd be rather surprised if that were
> the case. I've written an email client in Python and started before
> the email module (and its predecessor mimelib) was available. So I've
> done a bunch of fiddling with MIME messages using the email module and
> other tools and have yet to find anything to do with MIME messages
> that the email module doesn't make easier.
> 
> If you'll post a bit more about what you need to do, we may be able to
> help more.

I've encountered messages where there's a multi-part alternative message 
that's wrapping both text/plain and text/html versions of a message. I 
really don't want the HTML part (security problems galore), so I just want 
to kick back the text/plain sub-sections in this case. The boundaries 
(given by Message.get_boundary()) seperate them, but short of 
string.split-ing on that boundary, I'm at a loss for how to do this.

> At a guess, you may be running into the problem of duplicating the
> conventions followed by some particular email client or clients.

I think this may be the case, but being the perfectionist I am, I want to 
do the "right thing" no matter how badly mangled the email client may be. 
Handling input from well-behaved clients seems fairly trivial, but 
unfortunantly they seem to be in the minority.

> The email module hands back MIME parts and your program can do anything it
> likes with them. Replicating the behavior of some email client can be
> a nuisance but it's a nuisance that's separate from the nuisance of
> parsing MIME messages.

I suppose I don't want to replicate any behaviour (I'm only going to be 
sending plain-text email, no matter what), but I sure would like to be able 
to handle attachments intelligently.

Any help or code you could send would be great. Thanks again for your time.

Alex

-- 
Alex Russell
alex at securepipe.com
alex at netWindows.org



More information about the Python-list mailing list