Mailto links in Discourse emails are botched

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?

5 Likes

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

1 Like

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>

1 Like

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)
2 Likes

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

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>
4 Likes

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

4 Likes