attached is a patch that add -o or --output which allows you to save the output to a file.
diff --git a/monkeysign/ui.py b/monkeysign/ui.py index c9b6a30..43d15ed 100644 --- a/monkeysign/ui.py +++ b/monkeysign/ui.py @@ -93,6 +93,7 @@ class MonkeysignUi(object): help=_('do not send email at all (default: use sendmail)')) parser.add_option('-t', '--to', dest='to', help=_('override destination email for testing (default: send individually encrypted email to each uid chosen)')) + parser.add_option('-o', '--output', dest='output', help=_('save the output email to a file')) return parser def parse_args(self, args): @@ -381,6 +382,18 @@ expects an EmailFactory email, but will not mail if nomail is set""" not sending email to %s, as requested, here's the email message: %s""") % (msg.mailto, msg.create_mail_from_block())) + if self.options.output is not None: + if not os.path.exists(self.options.output): + try: + f = open(self.options.output, 'w'); + f.write(str(msg.create_mail_from_block())) + except IOError: + self.warn(_('Error opening or writing file %s') % self.options.output); + else: + f.close() + self.warn(_('Mail has been written to %s') % self.options.output) + else: + self.warn(_('Didn\'t write to %s, because file exists') % self.options.output) class EmailFactory:
signature.asc
Description: OpenPGP digital signature