-1

How to add page URL in HTML mailto: subject and body.

Even some dynamic variable values need to be added.

Thanks in advance

KrankyCode
  • 441
  • 1
  • 8
  • 24

3 Answers3

1

You can use the mailto in the url as :-

<a href="mailto:someone@example.com?Subject=Hello%20again">

It contains the recipients address and the subject... I hope this helps... :)

Deval Khandelwal
  • 3,458
  • 1
  • 27
  • 38
1

You can use this

        <body>

         <p>
          This is an email link:
         <a href="mailto:someone@example.com?Subject=Hello%20again">
                    Send Mail</a>
                   </p>



        </body>
        </html>

Note: Spaces between words should be replaced by %20 to ensure that the browser will display the text properly.

1

It's easy to add a subject and body message. I find it works OK without %20 between each word, but it's probably safer to use it. So you can either try this:

<a href="mailto:email@mysite.com?subject=Hi there&amp;body=This is my body message">Email Us</a>

or this

<a href="mailto:email@mysite.com?subject=Hi%20there&amp;body=This%20is%20my%20body%20 message">Email Us</a>

Note that I used &amp; rather than &, as just an & tends to be disliked in URLs. (It doesn't validate, anyhow.)

ralph.m
  • 13,468
  • 3
  • 23
  • 30