def decorate_message(self, event, message, decorates=None): """ Added headers to the outgoing email to track it's relationship with a resource. Reply-To will encode a UID as a email parameter so replies to the resource announcement can be handled by an ITracGateEmailHandler. """ if event.realm in self.reply_to_realms: name, email_addr = parseaddr(str(message['Reply-To'])) uid = uid_encode(self.env.abs_href(), event.realm, event.target) m = ADDR_REGEX.match(email_addr) new_email_addr = '%s+%s@%s'%(m.group(1), uid, m.group(2)) new_addr = formataddr((name, new_email_addr)) set_header(message, 'Reply-To', new_email_addr) return next_decorator(event, message, decorates)
def decorate_message(self, event, message, decorates=None): """ Added headers to the outgoing email to track it's relationship with a ticket. References, In-Reply-To and Message-ID are just so email clients can make sense of the threads. """ if to_unicode(event.realm) in self.supported_realms: uid = uid_encode(self.env.abs_href(), event.realm, event.target) email_from = self.config.get('announcer', 'email_from', 'localhost') _, email_addr = parseaddr(email_from) host = re.sub('^.+@', '', email_addr) mymsgid = msgid(uid, host) if event.category == 'created': set_header(message, 'Message-ID', mymsgid) else: set_header(message, 'In-Reply-To', mymsgid) set_header(message, 'References', mymsgid) return next_decorator(event, message, decorates)