JavaScript mailto: with subject and body – [Solution]

In this tutorial we are going to see how to write a javascript mailto function so that both the subject and body will be Pre-filled?

Many of us might have used mailto function just like below (passing only the mail id):


But there are other parameters also you can send it along with that, those are:

1. cc
2. bcc
3. subject
4. body

And one more important thing, you can also send to multiple recipients (see the below example):


Now lets form the entire structure including all the above parameters, test@examplecom?


Make sure you have encoded the text in Subject line and Body. You can see there is a %20 between texts in subject and body right?. Its nothing but space between the texts.

For your convenience, I have given an example code. Just copy and paste and have a try:

<a href=",,">Mail</a>


Leave a Reply

Theme: Overlay by Kaira