From ea5e0c2ae68a09305185f35253978648a08fd08f Mon Sep 17 00:00:00 2001 From: mcmaster Date: Wed, 20 Jan 2010 16:26:20 -0500 Subject: [PATCH] to_addrs not defined if 'To' header is non-existant --- gpg-mailgate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gpg-mailgate.py b/gpg-mailgate.py index 9b6997e..01009d3 100755 --- a/gpg-mailgate.py +++ b/gpg-mailgate.py @@ -19,12 +19,13 @@ for sect in _cfg.sections(): raw = sys.stdin.read() raw_message = email.message_from_string( raw ) from_addr = raw_message['From'] +to_addrs = list() if raw_message.has_key('To'): - to_addrs = map(lambda x: x.strip(), raw_message['To'].split(',')) + to_addrs.extend( map(lambda x: x.strip(), raw_message['To'].split(',')) ) if raw_message.has_key('Cc'): - to_addrs.extend( map(lambda x: x.strip(), raw_message['Cc'].split(','))) + to_addrs.extend( map(lambda x: x.strip(), raw_message['Cc'].split(',')) ) if raw_message.has_key('Bcc'): - to_addrs.extend( map(lambda x: x.strip(), raw_message['Bcc'].split(','))) + to_addrs.extend( map(lambda x: x.strip(), raw_message['Bcc'].split(',')) ) def send_msg( message, recipients = None ): if recipients == None: