News for hackers. Stuff that matters.

tomekwojcik

Re:Envelopes - Python email for humans on Thursday August 08, 2013 @07:10AM (#6178209)
envelopes.conn.SMTP is a wrapper for smtplib.SMTP that supports Envelope objects and is reusable. Envelope.send() is just a shorthand you can use if you don't care about reusing connections.

For requests it's simpler to support top-level functions, since in general HTTP request is self-contained. Envelope (or email.mime.MIMEMessage) object isn't enough to send an e-mail - you need to know the SMTP host, port, creds and set up the connection. While it's certainly possible to write envelopes.send() function that'd internally create an Envelope object and send it (all based on the args the function gets) I don't think it's that crucial.

Re:Envelopes - Python email for humans on Thursday August 08, 2013 @04:42AM (#6177870)
Note that, for CC and BCC addresses, there's a number of accepted formats. Consult docs for more info: http://tomekwojcik.github.io/envelopes/api/envelope.html
Re:Envelopes - Python email for humans on Thursday August 08, 2013 @03:26AM (#6177715)
I don't generally do Django, but I don't think it should be a problem. Just a word of warning - if you're going to use a global per-app SMTP connection remember to wrap it in connstack. The Flask example shows this and it shouldn't be hard to do the same in Django.
Re:Envelopes - Python email for humans on Thursday August 08, 2013 @03:24AM (#6177709)
Debug mode is a nice catch. Thanks.

As far as GMail SMTP goes, I've been using Envelopes over GMail SMTP for about a week with great success. The first example in the docs shows just that. Also, I have customized SMTP subclasses for GMail, SendGrid and local Mailcatcher in the pipeline. Using one of them, you'll only have to provide your creds to send e-mails.

Re:Envelopes - Python email for humans on Thursday August 08, 2013 @03:20AM (#6177694)
The API is still young and I'm perfectly aware it could use some love (especially that I wrote the first Envelopes class at 3AM while trying to simplify my workflow).

I've been considering renaming "from_addr" and "to_addr" to "from" and "to" but this would cause conflicts with Python's keywords. I'm, however, all over renaming them to "from_address" and "to_address". As far as "cc_addrs" and "bcc_addrs" - I think I'll use full "address" there, too (for the sake of consistency).

As for "text_body" and "html_body" - I'd like to leave those as they are. Depending on the case I may use one of them, both of them or neither of them.

Thanks for your feedback, it's much appreciated :).

Re:Envelopes - Python email for humans on Thursday August 08, 2013 @03:15AM (#6177691)
I'm aiming at Requests' robustness, but it's still a long way to go for Envelopes. Good news is - it works and sends e-mails :).

If you find any issues please report them at GitHub. Thanks and have fun.