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

Daniel Reis <[email protected]> Mon, 4 Feb 2013 09:39:51 +0000
Newsgroups gmane.comp.python.mime.devel
Message-ID <[email protected]>
--===============0952519248==
Content-Type: multipart/alternative;
	boundary="_6110cab2-7e33-4e79-84cd-a9112f43c166_"

--_6110cab2-7e33-4e79-84cd-a9112f43c166_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

David=2C

> > > PS: what is pyzlib?  It sounds like a wrapper for zlib=2C which is wh=
at
> > > I get when I google for it.

Got it: it's one of the top results if you search for "mail" in PyPi:
http://pypi.python.org/pypi?%3Aaction=3Dsearch&term=3Dmail&submit=3Dsearch


> Well=2C I'd prefer to avoid that at this stage=2C and leave those
> considerations for a later stage.  This is because that would lock us in
> to a particular=2C relatively complex API.  It would probably be better t=
o
> leave that as a non-stdlib wrapper class for now=2C as we make the email
> library more and more complete so that such wrappers become simpler and
> simpler=2C until it becomes clear if/where to add it to the library.

This wrapper is really needed.
Or at the very least. the examples in the Python docs should provide a comp=
lete example on generating an e-mail with text/html alternate parts plus at=
tachments. They don't.

I found a very good for-dummies reference and implementation here:
http://blog.magiksys.net/generate-and-send-mail-with-python-tutorial
(PS: just found out that it's author=2C Alain Spineux=2C is the author of p=
yzmail ...)

As an example=2C buiding an email looks like this:

mail=3Dgen_mail(
    (my_utext.encode('iso-8859-1')=2C 'iso-8859-1')=2C=20
    (my_html=2C 'us-ascii')=2C=20
     my_attachments=2C=20
     my_related_parts_list)
> So=2C right now the most helpful thing would be reviewing bugs (tagged
> 'email' in the tracker) and fixes.  Alternatively you could take a look
> at how I/we have done the header_factory in the new code=2C and think
> about what the corresponding message_factory would look like.  That will
> be the thing that will make managing attachments easier=2C and is what I
> plan to work on after finishing the list above.

Most of this is not very related to my current work and skill set. So unfor=
tunately I'm afraid I wouldn't be much help.=20
Maybe I could help improve the docs to add the more complete email usage ex=
ample=2C but would most certainly be at the expense of Alain Spineux's work=
 ...

Regards
Daniel Reis


 		 	   		  =

--_6110cab2-7e33-4e79-84cd-a9112f43c166_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 12pt=3B
font-family:Calibri
}
--></style></head>
<body class=3D'hmmessage'><div dir=3D'ltr'>David=2C<br><br>&gt=3B &gt=3B &g=
t=3B PS: what is pyzlib?  It sounds like a wrapper for zlib=2C which is wha=
t<br><div>&gt=3B &gt=3B &gt=3B I get when I google for it.<br><br>Got it: i=
t's one of the top results if you search for "mail" in PyPi:<br><a href=3D"=
http://pypi.python.org/pypi?%253Aaction=3Dsearch&amp=3Bterm=3Dmail&amp=3Bsu=
bmit=3Dsearch" target=3D"_blank">http://pypi.python.org/pypi?%3Aaction=3Dse=
arch&amp=3Bterm=3Dmail&amp=3Bsubmit=3Dsearch</a><br><br><br>&gt=3B Well=2C =
I'd prefer to avoid that at this stage=2C and leave those<br>&gt=3B conside=
rations for a later stage.  This is because that would lock us in<br>&gt=3B=
 to a particular=2C relatively complex API.  It would probably be better to=
<br>&gt=3B leave that as a non-stdlib wrapper class for now=2C as we make t=
he email<br>&gt=3B library more and more complete so that such wrappers bec=
ome simpler and<br>&gt=3B simpler=2C until it becomes clear if/where to add=
 it to the library.<br><br>This wrapper is really needed.<br>Or at the very=
 least. the examples in the Python docs should provide a complete example o=
n generating an e-mail with text/html alternate parts plus attachments. The=
y don't.<br><br>I found a very good for-dummies reference and implementatio=
n here:<br><a href=3D"http://blog.magiksys.net/generate-and-send-mail-with-=
python-tutorial" target=3D"_blank">http://blog.magiksys.net/generate-and-se=
nd-mail-with-python-tutorial</a><br>(PS: just found out that it's author=2C=
 Alain Spineux=2C is the author of pyzmail ...)<br><br>As an example=2C bui=
ding an email looks like this:<br><br><pre><span class=3D"n">mail</span><sp=
an class=3D"o">=3D</span><span class=3D"n">gen_mail</span><span class=3D"p"=
>(<br>    (</span><span class=3D"n">my_utext</span><span class=3D"o">.</spa=
n><span class=3D"n">encode</span><span class=3D"p">(</span><span class=3D"s=
">'iso-8859-1'</span><span class=3D"p">)=2C</span> <span class=3D"s">'iso-8=
859-1'</span><span class=3D"p">)=2C</span> <br>    <span class=3D"p">(</spa=
n><span class=3D"n">my_html</span><span class=3D"p">=2C</span> <span class=
=3D"s">'us-ascii'</span><span class=3D"p">)=2C</span> <br>     <span class=
=3D"n">my_attachments</span><span class=3D"p">=2C</span> <span class=3D"n">=
<br>     my_related_parts_list</span><span class=3D"p">)</span></pre><br>&g=
t=3B So=2C right now the most helpful thing would be reviewing bugs (tagged=
<br>&gt=3B 'email' in the tracker) and fixes.  Alternatively you could take=
 a look<br>&gt=3B at how I/we have done the header_factory in the new code=
=2C and think<br>&gt=3B about what the corresponding message_factory would =
look like.  That will<br>&gt=3B be the thing that will make managing attach=
ments easier=2C and is what I<br>&gt=3B plan to work on after finishing the=
 list above.<br><br>Most of this is not very related to my current work and=
 skill set. So unfortunately I'm afraid I wouldn't be much help. <br>Maybe =
I could help improve the docs to add the more complete email usage example=
=2C but would most certainly be at the expense of Alain Spineux's work ...<=
br><br>Regards<br>Daniel Reis<br><br><br></div> 		 	   		  </div></body>
</html>=

--_6110cab2-7e33-4e79-84cd-a9112f43c166_--

--===============0952519248==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline