Set a mailto link with a subject containing an ampersand (&)
Asked Answered
A

2

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?

Amok answered 15/5, 2014 at 15:1 Comment(0)
S
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

Spagyric answered 15/5, 2014 at 15:6 Comment(0)
A
5

use %26 for the & in the subject.

Anselmo answered 15/5, 2014 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.