[RFC] An EmailMessage class for bzrlib

Adeodato Simó dato at net.com.org.es
Wed Jun 20 02:17:45 BST 2007


Hello.

This is my proposed EmailMessage class for bzrlib. It basically consists
of a refactoring of the code in the original SMTPConnection class that
dealt with the creation of email messages.

This are the highlights:

  * simple(r) API, with the constructor covering most cases, and one single
    extra function to add additional parts to the message (this seems
    cleaner to me that the four functions in the original SMTPConnection;
    also (related to John's comment before), I don't think it makes
    sense to have an extra attachment paramenter in the constructor,
    because there can be an arbitrary number of them).

  * body and extra text attachments can be passed as unicode (and
    they'll get transferred as utf-8), or as byte strings (which will be
    transferred as-is, that is, charset=8-bit).

  * email addresses are properly RFC2047 encoded (that is, only the name
    part is encoded, not the whole address as the code in MergeDirective.to_email
    did); this comes pretty much straight from the original SMTPConnection.

  * all EmailMessages are a MIME multipart message; this should no be a
    problem, as per the answers I received on the list about it.

Please let me know what you think, in particular if you see any
shortcomings on the proposed API (eg. if it would not cover a certain
use case). After that, I'll rehash the tests found in the original
SMTPConnection into tests for this class, and submit for merge.

Cheers,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
And don't get me wrong - I don't mind getting proven wrong. I change my
opinions the way some people change underwear. And I think that's ok.
                -- Linus Torvalds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: email_message.diff
Type: text/x-diff
Size: 6173 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070620/441456ac/attachment.bin 


More information about the bazaar mailing list