1.1 --- a/imiptools/__init__.py Tue Oct 13 17:10:40 2015 +0200
1.2 +++ b/imiptools/__init__.py Tue Oct 13 18:34:26 2015 +0200
1.3 @@ -95,9 +95,22 @@
1.4 # However, outgoing messages do not usually presume anything about the
1.5 # eventual recipients and focus on the sender instead.
1.6
1.7 + # The sender's address is preferably derived from any outgoing recipient
1.8 + # address because the "From" header may provide a different address
1.9 + # (from the calendar system) to the actual address of the user.
1.10 +
1.11 else:
1.12 - Recipient(None, messenger, store, publisher, preferences_dir, self.handlers, self.outgoing_only, self.debug
1.13 - ).process(msg, senders)
1.14 + prefix = "%s+" % config.OUTGOING_PREFIX
1.15 + copied = [recipient[len(prefix):]
1.16 + for recipient in get_addresses(get_all_values(msg, "Bcc"))
1.17 + or []
1.18 + if recipient.startswith(prefix)] or \
1.19 + get_addresses(get_all_values(msg, "From")) or \
1.20 + []
1.21 +
1.22 + if copied and len(copied) == 1:
1.23 + Recipient(get_uri(copied[0]), messenger, store, publisher, preferences_dir, self.handlers, self.outgoing_only, self.debug
1.24 + ).process(msg, senders)
1.25
1.26 def process_args(self, args, stream):
1.27
1.28 @@ -236,7 +249,7 @@
1.29 # Check for participating recipients. Non-participating recipients will
1.30 # have their messages left as being unhandled.
1.31
1.32 - if self.outgoing_only or self.is_participating():
1.33 + if self.is_participating():
1.34
1.35 # Check for returned messages.
1.36