From 9babde1e22ffce2534f5c62b7e06afeb62261469 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 31 Jan 2008 18:29:29 +0100 Subject: [PATCH] * Let notify filter out Subject and From headers from the headers in the template, else there will be two in the actual message. --- tools/notify.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/notify.py b/tools/notify.py index 4530255..08bc477 100644 --- a/tools/notify.py +++ b/tools/notify.py @@ -36,14 +36,20 @@ def notify(recipients, template, context = {}): from_email = None for header in headers.split('\n'): (field, value) = header.split(':') - headers_dict[field] = value if (field == 'From'): from_email = value + elif (field == 'Subject'): + subject = value + else: + # Don't put From and Subject in the dict, else they'll be + # present twice. + headers_dict[field] = value msg = EmailMessage( # Only setting the From address through headers won't set the # envelope address right. from_email = from_email, + subject = subject, body = body, to = addresses, headers = headers_dict -- 2.30.2