Embedded links in email-in and reply by emaile


(Paul Apostolos) #1

Many times our users will use hyperlinks in their emails. Especially if they are copying and pasting HTML into their email client to reply to a topic or create a new one (via the email-in feature).

The HTML of those hyperlinks typically look like this

You should read this <a href="http://www.somesite.com">Interesting article</a>

That all gets clobbered in the conversion from email to markdown and it can end up looking quite terrible.

Short of telling 1,000 “get-off-my-lawn” users not to do that and causing an uprising, is there anything that can be done through settings to change that behavior?

(Jeff Atwood) #2

That HTML is supported in Markdown though. Can you provide a specific example with raw from the email and resulting post?

(Paul Apostolos) #3

From looking at the raw, it looks like it is pulling the Plain Text version of the email to parse. I used Outlook to send the message and I have included screen shots from the Gmail inbox and the Discourse output. Finally I included the relevant raw portion of the email (Gmail->show original). Obviously, Outlook is terrible at producing clean HTML, but it is widely used

Content-Type: multipart/alternative;
MIME-Version: 1.0
X-OriginatorOrg: mydomain.com

Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I would like to test the HTML linking<http://meta.discourse.org/> of email =
in topics.

Hopefully it works.

Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
/* Font Definitions */
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
a:link, span.MsoHyperlink
a:visited, span.MsoHyperlinkFollowed
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
<body lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">I would like to test the <a href=3D"http://meta.disc=
HTML linking</a> of email in topics.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Hopefully it works.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>


(Eyal Levin) #4

I have the same problem.

Looking at the source it seems that the email text_part is the only one being handled (at least from the gmail messages I checked) and the html_part which has the href formatting never gets hit.

But even if the html_part will be handled, at line 94 it looks to be stripped down from html attributes including the link.

I don’t mind trying to fix this but I’ll need some direction on the required logic.



(Kane York) #5

I have fixed this so that the HTML section is considered first and cleaned up - would love to have more testing on it!

At the moment, it cleans up some of the HTML then treats the rest as if you pasted it in the editor.