Website Knowledge

HTML, CSS, Javascript, jQuery and more

How to use mailto

Today I was working on a newsletter for FMR Web Design and I came across this case where I needed to open an outlook window with some text already showing in the subject line and the body. This is a simple task and we have all probably used it. For those who do not know I can summarize it here.

Just a simple email link is written as


So once you have this code for a link it will open the default email client with in the TO field. So now you want to show a default subject line. For that you can simply append ?subject=Your Subject to the above link. So it becomes


Next thing could that you want to add some text in the body of email. For that you add body=Your Body to the above link. So now it becomes:


So here is a new thing I learnt today! I wanted to write the text in body but then I needed some text written on the next line. So I found an equivalent of usually used in webpages. It is %0A . So now where you have the text for the body, if you add %0A, it moves the text to the next line. So now our last link would become:


That is it! Hope this tip would be useful!

Comments are closed