/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/email/emailer.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
213
213
        """Spawn a 'mail' subprocess to send the email."""
214
214
        # TODO think up a good test for this, but I think it needs
215
215
        # a custom binary shipped with. RBC 20051021
216
 
        with tempfile.NamedTemporaryFile() as msgfile:
 
216
        msgfile = tempfile.NamedTemporaryFile()
 
217
        try:
217
218
            msgfile.write(self.body().encode('utf8'))
218
219
            diff = self.get_diff()
219
220
            if diff:
228
229
            if rc != 0:
229
230
                raise errors.BzrError(
230
231
                    "Failed to send email: exit status %s" % (rc,))
 
232
        finally:
 
233
            msgfile.close()
231
234
 
232
235
    def _send_using_smtplib(self):
233
236
        """Use python's smtplib to send the email."""