1.1 --- a/conf/postfix/main.cf.example Wed Dec 10 17:35:00 2014 +0100
1.2 +++ b/conf/postfix/main.cf.example Wed Dec 10 18:42:08 2014 +0100
1.3 @@ -1,2 +1,3 @@
1.4 -virtual_alias_maps = $alias_maps, ldap:/etc/postfix/ldap/virtual_alias_maps_resources.cf, ldap:/etc/postfix/ldap/virtual_alias_maps_people.cf
1.5 +local_recipient_maps = ldap:/etc/postfix/ldap/local_recipient_maps.cf
1.6 +virtual_alias_maps = $alias_maps, hash:/etc/postfix/virtual, ldap:/etc/postfix/ldap/virtual_alias_maps_resources.cf, ldap:/etc/postfix/ldap/virtual_alias_maps_people.cf
1.7 sender_bcc_maps = ldap:/etc/postfix/ldap/virtual_alias_maps_people_outgoing.cf
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/conf/postfix/virtual Wed Dec 10 18:42:08 2014 +0100
2.3 @@ -0,0 +1,1 @@
2.4 +people-outgoing@example.com people-outgoing@example.com
3.1 --- a/imip_manager.py Wed Dec 10 17:35:00 2014 +0100
3.2 +++ b/imip_manager.py Wed Dec 10 18:42:08 2014 +0100
3.3 @@ -84,14 +84,14 @@
3.4 def send_message(self, sender):
3.5
3.6 """
3.7 - Create a full calendar object and send it to the organisers from the
3.8 - given 'sender'.
3.9 + Create a full calendar object and send it to the organisers, sending a
3.10 + copy to the 'sender'.
3.11 """
3.12
3.13 node = to_node(self.obj)
3.14 part = to_part("REPLY", [node])
3.15 - message = self.messenger.make_message([part], self.organisers, sender=sender)
3.16 - self.messenger.sendmail(self.organisers, message.as_string(), sender=sender)
3.17 + message = self.messenger.make_message([part], self.organisers, outgoing_bcc=sender)
3.18 + self.messenger.sendmail(self.organisers, message.as_string(), outgoing_bcc=sender)
3.19
3.20 # Action methods.
3.21
3.22 @@ -112,6 +112,8 @@
3.23 freebusy = self.store.get_freebusy(attendee)
3.24
3.25 attendee_attr["PARTSTAT"] = accept and "ACCEPTED" or "DECLINED"
3.26 + if self.messenger and self.messenger.sender != get_address(attendee):
3.27 + attendee_attr["SENT-BY"] = get_uri(self.messenger.sender)
3.28 self.details["ATTENDEE"] = [(attendee, attendee_attr)]
3.29 self.send_message(get_address(attendee))
3.30
3.31 @@ -433,12 +435,6 @@
3.32 self.out.write(unicode(self.page).encode(self.encoding))
3.33
3.34 if __name__ == "__main__":
3.35 - Manager(
3.36 - Messenger(
3.37 - "imip-agent@example.com",
3.38 - "Calendar system message",
3.39 - "This is a message from the calendar system."
3.40 - )
3.41 - )()
3.42 + Manager()()
3.43
3.44 # vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/imiptools/config.py Wed Dec 10 17:35:00 2014 +0100
4.2 +++ b/imiptools/config.py Wed Dec 10 18:42:08 2014 +0100
4.3 @@ -4,6 +4,10 @@
4.4
4.5 MESSAGE_SENDER = "calendar@example.com"
4.6
4.7 +# The outgoing message handling prefix.
4.8 +
4.9 +OUTGOING_PREFIX = "people-outgoing"
4.10 +
4.11 # The location of the stored calendar information.
4.12
4.13 STORE_DIR = "/var/lib/imip-agent/store"
5.1 --- a/imiptools/mail.py Wed Dec 10 17:35:00 2014 +0100
5.2 +++ b/imiptools/mail.py Wed Dec 10 18:42:08 2014 +0100
5.3 @@ -1,6 +1,6 @@
5.4 #!/usr/bin/env python
5.5
5.6 -from imiptools.config import MESSAGE_SENDER
5.7 +from imiptools.config import MESSAGE_SENDER, OUTGOING_PREFIX
5.8 from email.mime.message import MIMEMessage
5.9 from email.mime.multipart import MIMEMultipart
5.10 from email.mime.text import MIMEText
5.11 @@ -27,12 +27,13 @@
5.12 self.body_text = body_text or MESSAGE_TEXT
5.13 self.preamble_text = preamble_text or PREAMBLE_TEXT
5.14
5.15 - def sendmail(self, recipients, data, sender=None, lmtp_socket=None):
5.16 + def sendmail(self, recipients, data, sender=None, outgoing_bcc=None, lmtp_socket=None):
5.17
5.18 """
5.19 Send a mail to the given 'recipients' consisting of the given 'data',
5.20 - using the given 'sender' identity if indicated, delivering to a local
5.21 - mail system using LMTP if 'lmtp_socket' is provided.
5.22 + using the given 'sender' identity if indicated, indicating an
5.23 + 'outgoing_bcc' identity if indicated, delivering to a local mail system
5.24 + using LMTP if 'lmtp_socket' is provided.
5.25 """
5.26
5.27 if lmtp_socket:
5.28 @@ -40,14 +41,18 @@
5.29 else:
5.30 smtp = SMTP("localhost")
5.31
5.32 + if outgoing_bcc:
5.33 + recipients = list(recipients) + ["%s+%s" % (OUTGOING_PREFIX, outgoing_bcc)]
5.34 +
5.35 smtp.sendmail(sender or self.sender, recipients, data)
5.36 smtp.quit()
5.37
5.38 - def make_message(self, parts, recipients, sender=None):
5.39 + def make_message(self, parts, recipients, sender=None, outgoing_bcc=None):
5.40
5.41 """
5.42 Make a message from the given 'parts' for the given 'recipients', using
5.43 - the given 'sender' identity if indicated.
5.44 + the given 'sender' identity if indicated, indicating an 'outgoing_bcc'
5.45 + identity if indicated.
5.46 """
5.47
5.48 message = MIMEMultipart("mixed", _subparts=parts)
5.49 @@ -58,6 +63,8 @@
5.50 message["From"] = sender or self.sender
5.51 for recipient in recipients:
5.52 message["To"] = recipient
5.53 + if outgoing_bcc:
5.54 + message["Bcc"] = "%s+%s" % (OUTGOING_PREFIX, outgoing_bcc)
5.55 message["Subject"] = self.subject
5.56
5.57 return message