All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

HTML Email Link With Subject

Last Updated : Jul 1, 2023

HTML Email Link With Subject

In this tutorial we will show you the solution of HTML email link with subject and we will going to learn about how we are able to send an email from a webpage with subject.

In our previous article we understand that how we are able to send form data from webpage to email.

If you want to know about how to send form data to email then you must visit to our previous article. Now, in this article let’s understand how we are able to create email link with subject.

Step by step guide on HTML email link with subject :-

Here, below we give you codes in html as example that how to create email link with subject. For this instance, we specify that anchor tag is used for this purpose.

This article most of same to the previous one but with some changes. Let us understand the changes with help of codes.

<!DOCTYPE html>
      <html>
        <head>
          <title> Title of the document<title>
        </head>
          <body>
  <!-- this is general example for syntax purpose -->
<a href=”mailto : email@gmail.com?subject=this_is_test_mail”> click on this link to send email </a>
<br>
  <!-- this is another example -->
<a href=”mailto : testingmail@gmail.com?subject=here%20is%20my%20query&body=”> click on this link to send email with subject </a>
</body>
</html>
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here.
  5. Now, here is in body of html code, we create two anchor tags. Both of them are for same purpose but codes may be different. Let us understand them one by one.
  6. In first one, here we create an anchor tag with text click on this link to send email. And after that we use href attribute of anchor tag and in this we use mail to syntax to send email.
  7. And after that we use email id under this after this for subject we use ?subject with this and give value to subject with + sign. For reference you can see the code given above.
  8. Whereas in next anchor tag, all the contents are same as above but with difference of &body and this is used to send body text along with subject in email. We hope that you understand code properly.
  9. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

At last here in conclusion, we can say that with the help of this tutorial we are able create an email link with subject. I hope this tutorial on HTML email link with subject helps you.