# Mailto links in Discourse emails are botched

**URL:** https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253
**Category:** Bug
**Created:** [6월 6, 2018, 3:04오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253 "2018-06-06T15:04:17Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![lkramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lkramer/32/83897_2.png) [@lkramer](https://meta.discourse.org/u/lkramer)
#### Post date: [6월 6, 2018, 3:04오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/1 "2018-06-06T15:04:17Z")

</div>

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](mailto: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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [6월 7, 2018, 1:45오전 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/3 "2018-06-07T01:45:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lkramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lkramer/32/83897_2.png) [@lkramer](https://meta.discourse.org/u/lkramer)
#### Post date: [6월 7, 2018, 2:12오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/5 "2018-06-07T14:12:27Z")

</div>

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>`

---

<div class="post-metadata">

### Author: ![lkramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lkramer/32/83897_2.png) [@lkramer](https://meta.discourse.org/u/lkramer)
#### Post date: [6월 7, 2018, 7:02오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/6 "2018-06-07T19:02:18Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [6월 7, 2018, 8:46오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/7 "2018-06-07T20:46:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [6월 7, 2018, 9:13오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/8 "2018-06-07T21:13:34Z")

</div>

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.

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

```

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [6월 13, 2018, 2:28오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/9 "2018-06-13T14:28:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [6월 13, 2018, 2:28오후 UTC](https://meta.discourse.org/t/mailto-links-in-discourse-emails-are-botched/89253/10 "2018-06-13T14:28:34Z")

</div>


