Ashan Ashan - 3 months ago 10
HTML Question

HTML mailto subject with '&'

I need set subject to '&' sign from client side html.
I have following code,

<a href="mailto:no-one@snai1mai1.com?subject=free chocolate&Body=get free hurry.">example</a>


i need to set email subject :
free chocolate & cake


how to do this ?

Answer

You need to URL-encode the text; so it becomes:

<a href="mailto:no-one@snai1mai1.com?subject=free chocolate %26 cake&Body=get free hurry.">example
</a>

%26 is the Url-encoded representation of &