From 2217ec5fa589dd0353a05eec0eebf8d43073e34b Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 19 Jan 2013 13:22:49 -0500 Subject: [PATCH] email: Don't assume `extra_headers` has content in get_message() The default is None, so we should at least handle that case gracefully. Signed-off-by: W. Trevor King --- rss2email/email.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rss2email/email.py b/rss2email/email.py index 2f6872d..45b105f 100644 --- a/rss2email/email.py +++ b/rss2email/email.py @@ -112,9 +112,10 @@ def get_message(sender, recipient, subject, body, content_type, message['From'] = _formataddr((sender_name, sender_addr)) message['To'] = _formataddr((recipient_name, recipient_addr)) message['Subject'] = _Header(subject, subject_encoding) - for key,value in extra_headers.items(): - encoding = guess_encoding(value, encodings) - message[key] = _Header(value, encoding) + if extra_headers: + for key,value in extra_headers.items(): + encoding = guess_encoding(value, encodings) + message[key] = _Header(value, encoding) return message def smtp_send(sender, recipient, message, config=None, section='DEFAULT'): -- 2.26.2