passing body to mutt mail client

Bug #384158 reported by Edwin Grubbs on 2009-06-06
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Edwin Grubbs

Bug Description

Here is a patch for adding support for passing the email body to mutt.

--- 2009-06-05 19:12:55.000000000 -0500
+++ /tmp/ 2009-06-05 19:12:44.000000000 -0500
@@ -253,12 +253,12 @@

-class Mutt(ExternalMailClient):
+class Mutt(BodyExternalMailClient):
     """Mutt mail client."""

     _client_commands = ['mutt']

- def _get_compose_commandline(self, to, subject, attach_path):
+ def _get_compose_commandline(self, to, subject, attach_path, body=None):
         """See ExternalMailClient._get_compose_commandline"""
         message_options = []
         if subject is not None:
@@ -266,6 +266,14 @@
         if attach_path is not None:
                 self._encode_path(attach_path, 'attachment')])
+ if body is not None:
+ fd, temp_file = tempfile.mkstemp(prefix="mutt-body",
+ suffix=".txt")
+ try:
+ os.write(fd, body)
+ finally:
+ os.close(fd)
+ message_options.extend(['-i', temp_file])
         if to is not None:
             message_options.extend(['--', self._encode_safe(to)])
         return message_options

Thanks for the patch; please make a merge proposal for it.

Please also use a NamedTemporaryFile object not os.write unless
there's a compelling reason.

Martin <>

Changed in bzr:
assignee: nobody → Edwin Grubbs (edwin-grubbs)
importance: Undecided → Medium
status: New → Fix Committed
Edwin Grubbs (edwin-grubbs) wrote :

I submitted a merge proposal. BTW, the following wiki page says to use bundle buggy.

Martin Pool (mbp) wrote :

I'll merge this

Changed in bzr:
milestone: none → 1.16
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers