goors / gpg-mailgate

Playing with gpg-mailgate
0 stars 0 forks source link

Multi-part messages fail to encrypt #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set up an address who's messages will be encrypted
2. Send yourself a multi-part message, such as an email from Twitter
3. Message will not be received

What is the expected output? What do you see instead?
This is the error message I see in my postfix logs:
postfix/pipe[6798]: XXXXXXXXX: to=<EMAIL@DOMAIN.COM>, relay=gpg-mailgate, 
delay=0.44, delays=0.34/0.01/0/0.09, dsn=5.3.0, status=bounced (Command died 
with status 1: "/usr/local/bin/gpg-mailgate.py". Command output: Traceback 
(most recent call last):   File "/usr/local/bin/gpg-mailgate.py", line 98, in 
<module>     gpg.update( get_msg(raw_message) )   File 
"/usr/local/bin/gpg-mailgate.py", line 53, in get_msg     return '\n\n'.join( 
message.get_payload() ) TypeError: sequence item 0: expected string, instance 
found )

What version of the product are you using? On what operating system?
Ubuntu 10.04.3

Please provide any additional information below.
I modified get_msg(), this seems to work (sorry, my Python-foo is weak, I know 
it could be done in fewer lines):

def get_msg( message ):
        if not message.is_multipart():
                return message.get_payload()
        ret = ''
        for i in message.get_payload():
                ret = ret + str(i.get_payload()) + '\n\n'
        return ret

Original issue reported on code.google.com by paul.bro...@gmail.com on 14 Feb 2012 at 11:14