diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-18 09:21:03 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-18 09:21:03 -0400 |
commit | c1a84ab2e9fbdc28fde4ba377e65e9c8e53ee64f (patch) | |
tree | 3e0f21bcdc5fd928fe64e6c0565c3613864a8ae6 /interfaces/email/interactive/send_pgp_mime.py | |
parent | 6c0b67973dd95dfdc0ddfb29edfb793773f7115c (diff) | |
download | bugseverywhere-c1a84ab2e9fbdc28fde4ba377e65e9c8e53ee64f.tar.gz |
Added "to_unicode" to send_pgp_mime.flatten()
be-handle-mail wants unicode output, since all it's internal
processing is done with unicode. However, the flatten calls in
send_pgp_mime work with the encoded binary string output, and
execute(sendmail, stdin=flatten(msg, to_unicode=True)) fails
with
Exception: u
while executing /usr/sbin/sendmail -t
sendmail: fatal: wking(1001): No recipient addresses found in message header
Diffstat (limited to 'interfaces/email/interactive/send_pgp_mime.py')
-rw-r--r-- | interfaces/email/interactive/send_pgp_mime.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/interfaces/email/interactive/send_pgp_mime.py b/interfaces/email/interactive/send_pgp_mime.py index 38a2437..e0451c9 100644 --- a/interfaces/email/interactive/send_pgp_mime.py +++ b/interfaces/email/interactive/send_pgp_mime.py @@ -155,7 +155,7 @@ def replace(template, format_char, replacement_text): str = regexp.sub(replacement_text, str) return str -def flatten(msg): +def flatten(msg, to_unicode=False): """ Produce flat text output from an email Message instance. """ @@ -164,8 +164,10 @@ def flatten(msg): g = Generator(fp, mangle_from_=False) g.flatten(msg) text = fp.getvalue() - encoding = msg.get_content_charset() - return unicode(text, encoding=encoding) + if to_unicode == True: + encoding = msg.get_content_charset() + text = unicode(text, encoding=encoding) + return text def source_email(msg, return_realname=False): """ |