34

Im using the following mailto link to send an email:

 <a class="share3" title="" href="mailto:?subject=@check&amp;body=@domain">

It works well, but sometimes my subject will contain an ampersand (&) character, and when it does my email is created without a body.

Any way to resolve this problem?

Mike G
  • 4,232
  • 9
  • 40
  • 66
zooblin
  • 2,172
  • 2
  • 27
  • 33

2 Answers2

35

In order to get special/reserved characters into a URL, you must encode them - to get an & to work, it must be encoded to %26.

More details here: http://www.w3schools.com/tags/ref_urlencode.asp

edcs
  • 3,847
  • 2
  • 33
  • 56
5

use %26 for the & in the subject.

Alex
  • 8,875
  • 2
  • 27
  • 44