def __init__(self, mbox, mailid, request, form, **kwargs): super(ReplyModifier, self).__init__(mbox, mailid, request, dformat="EDITOR", **kwargs) self.textheader = "%s %s" % (self.From, _("wrote:")) if hasattr(self, "Message_ID"): form.fields["origmsgid"].initial = self.Message_ID if not hasattr(self, "Reply_To"): form.fields["to"].initial = self.From else: form.fields["to"].initial = self.Reply_To if request.GET.get("all", "0") == "1": # reply-all form.fields["cc"].initial = "" toparse = self.To.split(",") if hasattr(self, 'Cc'): toparse += self.Cc.split(",") for addr in toparse: tmp = EmailAddress(addr) if tmp.address and tmp.address == request.user.username: continue if form.fields["cc"].initial != "": form.fields["cc"].initial += ", " form.fields["cc"].initial += tmp.fulladdress m = re.match("re\s*:\s*.+", self.Subject.lower()) if m: form.fields["subject"].initial = self.Subject else: form.fields["subject"].initial = "Re: %s" % self.Subject
def parse_address(value, **kwargs): """Parse an email address. """ addr = EmailAddress(value) if "full" in kwargs.keys() and kwargs["full"]: return to_unicode(addr.fulladdress) result = addr.name and addr.name or addr.fulladdress return to_unicode(result)
def parse_address(value, **kwargs): addr = EmailAddress(value) if "full" in kwargs.keys() and kwargs["full"]: return IMAPheader.to_unicode(addr.fulladdress) result = addr.name and addr.name or addr.fulladdress return IMAPheader.to_unicode(result)