# html/Mailto question

**URL:** <https://boards.straightdope.com/t/html-mailto-question/80783>\
**Category:** Factual Questions\
**Created:** [September 11, 2001, 12:21am UTC](https://boards.straightdope.com/t/html-mailto-question/80783 "2001-09-11T00:21:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LifeWillFall](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@LifeWillFall](https://boards.straightdope.com/u/LifeWillFall)\
**Post date:** [September 11, 2001, 12:21am UTC](https://boards.straightdope.com/t/html-mailto-question/80783/1 "2001-09-11T00:21:51Z")

</div>

Is there some way to make the mailto tag automatically add a subject line of my choice when someone clicks that link. For Example: Joe Schmoe comes to my web site and clicks the “Email me” button and an E-mail window pops up with my E-mail address and the subject line already filled out?

sorry if this can be found with a web search, I looked, but found it had to sort out.

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [September 11, 2001, 12:22am UTC](https://boards.straightdope.com/t/html-mailto-question/80783/2 "2001-09-11T00:22:46Z")

</div>

a [href=mailto:bob@bob.com](mailto:href=mailto:bob@bob.com)?subject=Hi bob

there you go!

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [September 11, 2001, 12:28am UTC](https://boards.straightdope.com/t/html-mailto-question/80783/3 "2001-09-11T00:28:57Z")

</div>

If you want spaces in the subject you should properly HTML-escape them just to ensure browser compatibility.

Thus:

\<a [href="mailto:bob@bob.com](mailto:href=%22mailto:bob@bob.com)?subject=Hi%20Bob"\>

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [September 11, 2001, 12:30am UTC](https://boards.straightdope.com/t/html-mailto-question/80783/4 "2001-09-11T00:30:13Z")

</div>

Also note that not all browsers/email clients support the ?subject= syntax.

---

<div class="post-metadata">

**Author:** ![xash](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xash](https://boards.straightdope.com/u/xash)\
**Post date:** [September 11, 2001, 12:41am UTC](https://boards.straightdope.com/t/html-mailto-question/80783/5 "2001-09-11T00:41:04Z")

</div>

you can even create a pre-typed body affixing &body=

requiring the user to click only the send button, with the whole email pre-typed…

e.g. \<a [href="mailto:bob@bob.com](mailto:href=%22mailto:bob@bob.com)?subject=Hi%20Bob&body=type%20preset%20text%20here\>click here\</a\>

use escape characters for slashes, spaces etc.

note that different email clients may read the same links differently…
