0

I have a problem in clicking a link to send an email with body text where '&' character is there in the text. Below is code:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<a href = "mailto:xxx.xxx@xx.xxx.com?subject=Approval&body=AdventureWorks L&amp;L Azure dataset">Click</a href>

</body>
</html>

If you click on the link, it will open Outlook with proper subject and mail to option, but in Body of the mail it's printing only till '&' (AdventureWorks L ), Can anyone give me a solution where entire text will come on body of the mail along with '&' sign. ? I need "AdventureWorks L&L Azure dataset" in the body of the mail which will open while clicking on the link.

Thanks in advance.

1 Answers1

3

&amp; is also the same as &. This means a new parameter separator in the URL.

You have to encode it for the url, which is %26. If you replace &amp; with %26, there will be no problem.

Just a small note, the closing tag below is incorrect. No need to add attributes to closing tags, correct usage </a>

</a href>
BOZ
  • 2,731
  • 11
  • 28