From: Matthijs Kooijman Date: Thu, 31 Jan 2008 17:29:29 +0000 (+0100) Subject: * Let notify filter out Subject and From headers from the headers in the template... X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=9babde1e22ffce2534f5c62b7e06afeb62261469;p=matthijs%2Fprojects%2Fxerxes.git * Let notify filter out Subject and From headers from the headers in the template, else there will be two in the actual message. --- 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