[MERGE] An EmailMessage class for bzrlib (v1)

John Arbash Meinel john at arbash-meinel.com
Fri Jul 6 19:36:53 BST 2007

John Arbash Meinel has voted +1 (conditional).
Status is now: Conditionally approved
Overall, I think the class does what we want. I think we want a way to 
set the attachment type from the simple 'send()' helper, because 
otherwise attachments show up as 'text/plain' rather than 
'text/x-patch'. That is fairly minor.

This needs to be in a try/finally, so that a failure doesn't mess up the 
+        old_send_email = SMTPConnection.send_email
+        EmailMessage.send(FakeConfig(), 'from at from.com', 'to at to.com',
+                'subject', u'b\xf3dy', u'a\nb\nc\nd\ne\n', 'lines.txt')
+        SMTPConnection.send_email = old_send_email

   old_send_email = SMTPConnection.send_email
     EmailMessage.send(FakeConfig(), 'from at from.com', 'to at to.com',
          'subject', u'b\xf3dy', u'a\nb\nc\nd\ne\n', 'lines.txt')
     SMTPConnection.send_email = old_send_email

otherwise I'm happy with it.

I think we can easily make the important fix before we merge it. We may 
want to discuss the other change.

It would be nice if we could have a way to send an email as a single 
chunk (non mime) because that is what I believe PQM needs. (So it means 
that both bzr-email and bzr-pqm can share the email code).
I don't think it is easy to do, though, because if you start with a 
single body, and then add an attachment, you have to start over (at 
least that is what I understood about e-mail, which is why bzr-email 
doesn't do it that way).

I'm guessing this isn't going into 0.18, but if it is, I'd be willing to 
clean up the one bit and merge it.

For details, see: 

More information about the bazaar mailing list