Mailto links in Discourse emails are botched


(Leah Kramer) #1

Hello. A user of ours recently pointed this bug out out. It wouldn’t be too big of a deal except that his web host (Lunar Pages) actually flags his Discourse emails as suspicious because of this and perhaps other email/hosts might as well.

Let’s say someone makes a post in Discourse like:

Hi there. I can help you. Email me at username@domain.com.

Discourse properly turns that into a “mailto” link on the forum itself. But when that post appears in a Discourse email, the underlying html is:
<a href="https://www.forumurl.commailto:username@domain.com">username@domain.com</a>

Instead of:
<a href="mailto:username@domain.com">username@domain.com</a>

Is this happening to others as well?


(Jeff Atwood) #3

Are you referring to email or the post body? @jomaxro can you test in an email just to see?


(Leah Kramer) #5

In emails that Discourse sends out (e.g. mailing list mode emails), any email address within in a post gets mucked up like so:

<a href="https://www.forumurl.commailto:username@domain.com">username@domain.com</a>


(Leah Kramer) #6

In case this is helpful, I just verified that this happens to us in all three types of emails that Discourse sends:

  1. Activity summary emails (“Since your last visit…”)
  2. Mailing list mode emails
  3. Daily digest emails (no longer a part of Discourse but someone wrote us a plugin for this which copied the old code for this)

(Jeff Atwood) #7

OK cool @neil can I add this to your plate to fix? We should maybe backport the fix too.


(Joshua Rosenfeld) #8

I can confirm this (sorry for the delay) - the HTML definitely appears broken in the raw email. This affects standard email notifications (watching a topic, mentioned, etc) in addition to the emails mentioned above.

<a href="https://try.discourse.orgmailto:test@example.com" style="text-decoration: none; font-weight: bold; color: #006699;">test@example.com</a>

(Neil Lalonde) #9

This bug is fixed, and ported to the stable branch.


(Neil Lalonde) #10