1.1 --- a/imip_agent.py Tue Sep 23 17:32:22 2014 +0200
1.2 +++ b/imip_agent.py Tue Sep 23 19:51:14 2014 +0200
1.3 @@ -16,6 +16,12 @@
1.4
1.5 OWNER = "resource+manager@example.com"
1.6
1.7 +MESSAGE_SUBJECT = "Calendar system message"
1.8 +
1.9 +MESSAGE_TEXT = """\
1.10 +This is a response to a calendar message sent by your calendar program.
1.11 +"""
1.12 +
1.13 # Postfix exit codes.
1.14
1.15 EX_USAGE = 64
1.16 @@ -155,14 +161,15 @@
1.17 # Pack the parts into a single message.
1.18
1.19 if all_parts:
1.20 - if len(all_parts) > 1:
1.21 - message = MIMEMultipart("alternative", _subparts=all_parts)
1.22 - else:
1.23 - message = all_parts[0]
1.24 + text_part = MIMEText(MESSAGE_TEXT)
1.25 + all_parts.insert(0, text_part)
1.26 + message = MIMEMultipart("alternative", _subparts=all_parts)
1.27 + message.preamble = MESSAGE_TEXT
1.28
1.29 message["From"] = OWNER
1.30 for sender in senders:
1.31 message["To"] = sender
1.32 + message["Subject"] = MESSAGE_SUBJECT
1.33
1.34 if "-d" in sys.argv:
1.35 print message