[Email-SIG] FW: [Python-ideas] Standard library high level support for email messages

R. David Murray rdmurray at bitdance.com
Wed Jan 30 17:28:26 CET 2013


On Wed, 30 Jan 2013 16:08:26 +0000, Daniel Reis <dreis.pt at hotmail.com> wrote:
> Python, as a "batteries included" language, strives to provide out of
> the box solution for most common programming tasks.  Composing and
> sending email messages is a common task, supported by `email` and
> `smtplib` modules.
> 
> However, a programmer not familiar with MIME won't be able to create
> non-trivial email messages.  Actually, this proposal idea comes from
> the frustration of fast learning about MIME to get the job done, and
> later learn that some people´s email clients couldn't properly display
> the messages because I tripped in some details of multipart messages
> with Text+HTML and attachments.
> 
> You can call me a bad programmer, but couldn't / shouldn't this be
> easier?  Should a programmer be required to know about MIME in order
> to send a decently composed email with images or attachments?
> 
> The hardest part is already built in. Why not go that one step further
> and add to the email standard library an wrapper to handle common
> email composition without exposing the MIME details.
> 
> Something similar to
> http://code.activestate.com/recipes/576858-send-html-or-text-email-with-or-without-attachment,
> or perhaps including a lib such as pyzlib.

I'm currently working on building up to this, starting at the bottom
(the email package) and working my way up.  I haven't been able to spend
much time on it lately, but I plan to start again next month.

At this point we have transparent handling of unicode in message headers
when using the new email policies in 3.3.  I still have some cleanup
work to do there.  Once that is done, the next step is making it easy to
add attachments.  We haven't fully worked out the design for that yet,
though we had some extensive preliminary discussions a couple years ago :)

In 3.2, smtplib already has a send_message method that will accept a
Message object and send it.

Once attaching things is easy, I think that plus send_message will get
you 90+% of the way to where you would like to be.

I would welcome help working on this.  If you want to assist, this list
is probably the best place to talk about it.

--David

PS: what is pyzlib?  It sounds like a wrapper for zlib, which is what
I get when I google for it.


More information about the Email-SIG mailing list