How to create a link to send email with a subject in HTML?

JavascriptWeb DevelopmentFront End Scripts

To create a link to send email, use <a> tag, with href attribute. The mail to link is added inside the <a> tag. To add a subject, you need to add ? and then include the subject. All this comes inside the <a> tag.

Just keep in mind to add the email address where you want to receive the email in the mail to link. Also, the spaces between words for the subject shouldn’t be space, instead include %20. This is to ensure the browser displays the text properly.

Example

You can try to run the following code to create a link to send an email with a subject in HTML.

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Email with subject</title>
   </head>

   <body>
      <h1>Contact</h1>
      <p>For any queries:<a href="mailto:demo@example.com?Subject=My%20Query">Contact us</a></p>
   </body>
</html>
raja
Published on 01-Feb-2018 10:59:11
Advertisements