Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit 99e5990

Browse files
committed
Fixed issue when replying to mail with quoted From.
fix #199
1 parent 1ef390f commit 99e5990

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

modoboa_webmail/lib/imapemail.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from modoboa.lib import u2u_decode
2121
from modoboa.lib.email_utils import Email, EmailAddress
2222

23-
from .. import constants
2423
from . import imapheader
2524
from .attachments import get_storage_path
2625
from .imaputils import (
@@ -96,7 +95,11 @@ def get_header(self, msg, hdrname, **kwargs):
9695
9796
We also try to decode the default value.
9897
"""
99-
hdrvalue = super(ImapEmail, self).get_header(msg, hdrname)
98+
hdrvalue = super().get_header(msg, hdrname)
99+
if hdrname in ["From", "Reply-To"]:
100+
# Store a raw copy for further use
101+
setattr(self, "original_{}".format(hdrname.replace("-", "")),
102+
hdrvalue)
100103
if not hdrvalue:
101104
return ""
102105
try:
@@ -275,17 +278,17 @@ class ReplyModifier(Modifier):
275278
]
276279

277280
def __init__(self, *args, **kwargs):
278-
super(ReplyModifier, self).__init__(*args, **kwargs)
281+
super().__init__(*args, **kwargs)
279282

280283
self.textheader = u"%s %s" % (self.From, _("wrote:"))
281284
if self.dformat == "html":
282285
self.textheader = u"<p>{}</p>".format(self.textheader)
283286
if hasattr(self, "Message_ID"):
284287
self.form.fields["origmsgid"].initial = self.Message_ID
285288
if not hasattr(self, "Reply_To"):
286-
self.form.fields["to"].initial = self.From
289+
self.form.fields["to"].initial = self.original_From
287290
else:
288-
self.form.fields["to"].initial = self.Reply_To
291+
self.form.fields["to"].initial = self.original_ReplyTo
289292
if self.request.GET.get("all", "0") == "1": # reply-all
290293
self.form.fields["cc"].initial = ""
291294
toparse = self.To.split(",")

0 commit comments

Comments
 (0)