jeremy-compostella / org-msg

OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
GNU General Public License v3.0
275 stars 58 forks source link

Quoted message says parent mail was sent to nil #77

Closed wilhelmy closed 3 years ago

wilhelmy commented 3 years ago

I just replied to an email, and the To: header in the quoted message came out as a link titled nil (if I hover over it, it contains my email) after I sent it. Can anyone confirm this?

fukushima-2020-12-03_00:27:37

Edit: I'm using mu4e, not sure whether that makes a difference.

jeremy-compostella commented 3 years ago

Could you share the information to reproduce the issue ? Like an email exported as HTML with which I can reproduce ?

wilhelmy commented 3 years ago

I'll have to try to reproduce it myself, I think I was stressed at the time and I'll have to look into it again when I have time.

iirc it was in the HTML part of the multipart message which I don't normally look at, not sure it was actually when replying or forwarding. Sorry, that's all I remember right now.

Edit: I also think I recall that it was a message sent from Outlook, maybe that's relevant.

jeremy-compostella commented 3 years ago

This is likely a bug in the parsing transforming email address to link. I can't do anything without a HTML export of an email with which you reproduce the issue.

konezny commented 3 years ago

This issue has to do with the format of the email addresses. I have observed that nil occurs when the format of the To: or Cc: email address is something like username@somewhere.com or <username@somewhere.com> rather than something like "User Name" <username@somewhere.com> or User Name <username@somewhere.com>. The first two formats show up as nil in the reply.

wilhelmy commented 3 years ago

Thanks @konezny, I can confirm this.

jeremy-compostella commented 3 years ago

I still cannot reproduce. Could you please provide an HTML file which reproduces ? When you reply to an email with which you reproduce the issue, the :reply-to: property points to a HTML file. Could you share this HTML file ?

wilhelmy commented 3 years ago

I can reproduce it with this minimal-ish HTML message that I modified from the one I could reproduce it with before. Does that help? It probably doesn't matter what's in the HTML at all, just that there's a non-empty HTML message?

MIME-Version: 1.0
Date: Tue, 06 Apr 2021 16:26:28 +0200
Message-ID: <6AE325041EDEF6E2F6521F1E04C99CE4B837D8E7@V0201876CXAP006ASDF>
From: test@example.com
Reply-To: test@example.com
To: me@example.net
Subject: Test
Content-Type: multipart/related; boundary="1eb7458efba040af9250"

This is a multipart message in MIME format.
--1eb7458efba040af9250
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<?xml version=3D"1.0" ?>
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns=3D"http://w=
ww.w3.org/1999/xhtml">
<head><META http-equiv=3D"Content-Type" content=3D"text/html;charset=3Dutf-=
8">
<meta content=3D"TX21_HTM 21.0.406.500" name=3D"GENERATOR" />
<title></title>
 <style media=3D"all" type=3D"text/css"> td {font-family:Arial;} @-ms-viewp=
ort {
  width: device-width;
}
</style> <!--[if gte mso 9]>=0A<xml>=0A<o:OfficeDocumentSettings>=0A<o:Allo=
wPNG/>=0A<o:PixelsPerInch>96</o:PixelsPerInch>=0A</o:OfficeDocumentSettings=
>=0A</xml>=0A<![endif]-->=0A<meta name=3D"viewport" content=3D"width=3Ddevi=
ce-width, initial-scale=3D1">
</head>
<body style=3D"font-family:'Arial';font-size:12pt;text-align:left;">
</body></html>

When replying to the above message and sending the mail, and then displaying the message I just sent, I get this result: fukushima-2021-04-27_16:42:29

jeremy-compostella commented 3 years ago

Unfortunately, this is not the HTML file I was talking about. I was talking about the HTML file that is generated by the org-msg-save-article-for-reply-mu4e function when you hit reply in your mail agent and that the OrgMsg edit buffer is created. This HTML file path will given in the Org Mode Edit :reply-to: property. This is the file I would like to see.

Also make sure you use the latest org-msg version as they have been some changes in org-msg-save-article-for-reply-mu4e.

jeremy-compostella commented 3 years ago

@wilhelmy, do you still reproduce with the latest ?

jeremy-compostella commented 3 years ago

@wilhelmy, I would think that b9b5b4e would have fixed that issue. Could you confirm?

wilhelmy commented 3 years ago

Sorry, got side-tracked. I'm running HEAD now (see screenshot) and it still happens. Here's the html from the reply-to file:

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/1999/xhtml">
<head><META http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta content="TX21_HTM 21.0.406.500" name="GENERATOR" />
<title></title>
 <style media="all" type="text/css"> td {font-family:Arial;} @-ms-viewport {
  width: device-width;
}
</style> <!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="font-family:'Arial';font-size:12pt;text-align:left;"><div align="left">
From: nil &lt;test@example.com&gt;<br>
Subject: Test<br>
To: nil &lt;me@example.net&gt;<br>
Cc: <br>
Date: Tue, 06 Apr 2021 16:26:28 +0200<br>
</div>
<hr>

</body></html>

Edit: forgot screenshot fukushima-2021-04-30_13:32:04 Hm, seems like that's the available version from melpa, not the one I have installed via doom-emacs.

jeremy-compostella commented 3 years ago

Based on the input (email shared last week) and output shared over the week-end, I would think that this issue should be fixed and that you are not running the latest. I suggest that you do a C-h f org-msg-save-article-for-reply-mu4e then click on the org-msg.el link and verify that the mails2str() subfunction looks like:

    (cl-flet* ((mails2str (l)
         (mapconcat (lambda (m)
                  (let ((name (or (car m) (cdr m))))
                (format "%S &lt;%s&gt;" name (cdr m))))
                l ", "))

Most likely in your case it will look like.

    (cl-flet* ((mails2str (l)
         (mapconcat (lambda (m)
                  (format "%S &lt;%s&gt;" (car m) (cdr m)))
                l ", "))

If I am right it means that you are not running the version you pretend you are running. Otherwise, we need to investigate as I have absuletly no idea how you can end up with such a behavior when the code says that if the name is nil it uses the address as the name.

wilhelmy commented 3 years ago

Yes, I'm seeing the old version of the function. Sorry for the noise. After figuring out how to update individual packages and recompiling I can confirm that it is fixed now. Thanks!