the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
924 stars 109 forks source link

Reply body is partial when the original message has multiple nodes with `class="mail-body"` #1641

Closed SergeyMosin closed 2 weeks ago

SergeyMosin commented 2 weeks ago

Describe the bug When replying to a HTML messages that has multiple nodes with class="mail-body" (see image below) only the first node is copied into the reply composer window.

Possibly related to this function https://github.com/the-djmaze/snappymail/blob/68218e43dcc286a3f640bd5e543a4930924b3313/dev/Model/Message.js#L536-L546


image

the-djmaze commented 2 weeks ago

I wonder which mail application makes such a mess of our viewer. Because only one <body> element should be in the HTML, but you received a message with three <body> elements.

SergeyMosin commented 2 weeks ago

I wonder which mail application makes such a mess of our viewer. Because only one <body> element should be in the HTML, but you received a message with three <body> elements.

I think the message was generated by some scheduling software and sent via gmail and the forwarded by apple mail. Here is redacted structure:

X-Amavis-Modified: Mail body modified (using disclaimer) ...
Content-Type: multipart/alternative;
    boundary="Apple-Mail=_F582449E-7B66-4A5B-97E5-7A96613F1556"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\))
X-Mail-Calendar-Part: Yes
X-Mailer: Apple Mail (2.3731.200.110.1.12)

--Apple-Mail=_F582449E-7B66-4A5B-97E5-7A96613F1556
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
    charset=utf-8

TEXT_REDACTED...

--Apple-Mail=_F582449E-7B66-4A5B-97E5-7A96613F1556
Content-Type: multipart/mixed;
    boundary="Apple-Mail=_7DE24DA3-B494-4157-AAD2-FD178227A3AE"

--Apple-Mail=_7DE24DA3-B494-4157-AAD2-FD178227A3AE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
    charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;">...HTML_REDACTED...</body></html>=

--Apple-Mail=_7DE24DA3-B494-4157-AAD2-FD178227A3AE
Content-Disposition: attachment;
    filename=invite.ics
Content-Type: text/calendar;
    x-unix-mode=0644;
    name="invite.ics"
Content-Transfer-Encoding: quoted-printable

BEGIN:VCALENDAR=0D=0APRODID:-//Google=20Inc//Google=20Calendar=20=
70.9054//EN=0D=0A...DATA_REDACTED...END:VCALENDAR=0D=
=0A=

--Apple-Mail=_7DE24DA3-B494-4157-AAD2-FD178227A3AE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
    charset=us-ascii

<html><body style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: =
space; line-break: after-white-space;"><head><meta =
http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dus-ascii"></head>...HTML_REDACTED...</body></html>=

--Apple-Mail=_7DE24DA3-B494-4157-AAD2-FD178227A3AE
Content-Disposition: inline;
    filename=logo-email-sig-color.png
Content-Type: image/png;
    name="logo--email-sig-color.png"
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAAUUAAAA9CAYAAAA6cntFAAAACXBIWXMAAAqWAAAKlgGvphT+A...
--Apple-Mail=_7DE24DA3-B494-4157-AAD2-FD178227A3AE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
    charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><div><div><span></span>
</div>
<div><br><blockquote type=3D"cite">...HTML_REDACTED...</blockquote></div><br></div></body></html>=

--Apple-Mail=_7DE24DA3-B494-4157-AAD2-FD178227A3AE--

--Apple-Mail=_F582449E-7B66-4A5B-97E5-7A96613F1556--
the-djmaze commented 2 weeks ago

I see. Apple mail has 3 text/html parts. SnappyMail merges all parts because they are not marked as being inline or attachment (as RainLoop has made the code).

Instead of the current workaround by merging them. Maybe merge the last two as blockquote?