adding text automatically to an email loaded in mailto: link

2.5k views Asked by At

I currently have a mailto: link on my website so the user can email myself, however what I am trying to work out is how I can add compulsory text to the email they send me. To clarify I want a sentence to load inside the email when they click the mailto: link.

Thanks

the html code for the mailto: link is below

<div align="center"><a href="mailto:[email protected]"><img src="mailimage.png" width="75" height="75"/></a></div>
3

There are 3 answers

0
Amy On BEST ANSWER

Add Body parameter to your mailto url:

<div align="center"><a href="mailto:[email protected]?subject=Your_Subject&body=Your_Body_Text"><img src="mailimage.png" width="75" height="75"/></a></div>

This Tool is useful for making Email Link: http://angrytools.com/email/

1
user2952238 On
<div align="center"><a href="mailto:[email protected]?body=yourtext"><img src="mailimage.png" width="75" height="75"/></a></div>

Added body parameter to the href. ?body=yourtext

0
Sunny R Gupta On
<a href="mailto:[email protected]?subject=This%20is%20the%20subject&[email protected]&body=This%20is%20the%20body">Send email</a>

As you can see in addition to the To address, we can easily specify:

  1. The Subject
  2. The Body
  3. CC Address

The latest RFC for the same can be found here: https://www.rfc-editor.org/rfc/rfc6068. The Wikipedia article for mailto is also detailed.

Make sure you URL encode any text you add to the body and subject.

An online text to URL encoder can be found here.