How To Create An Email Link In HTML


Creating an email link in HTML is a straightforward process that involves using the "mailto" attribute. Follow these steps to create an email link in HTML:

 

Create An Email Link In HTML

Step 1: Open a text editor or an HTML editor like Notepad++, Sublime Text, or Visual Studio Code.

 

Step 2: Begin your HTML code by typing the <html> tag and including the <head> and <body> tags. Your code should look something like this:

 

php

 

<!DOCTYPE html>

<html>

<head>

<title>Email Link Example</title>

</head>

<body>

</body>

</html>


Step 3: Use the <a> tag to make a link inside the body> tag. In HTML documents, this tag is used to make links. Put the text you want to be the link inside the <a> tag, such as "Contact Us" or "Email Me." For example:

 

php

 

<a href="#">Contact Us</a>


Step 4: Add the "mailto" attribute to the a> tag and set its value to the email address you want to use. When the link is clicked, this tells the browser to open the default email client with a new email message addressed to the given email address. For example:

 

php

 

<a href="mailto:example@email.com">Email Me</a>


Step 5: You can also include a subject line in the email by adding the "subject" parameter to the mailto link. This can be done by adding "?subject=" followed by the desired subject line text. For example:

 

php

 

<a href="mailto:example@email.com?subject=Website Inquiry">Email Me</a>


Step 6: By adding the "body" parameter to the mailto link, you can also add a body text to the email. You can do this by adding "&body=" and then the body text you want. For example:

 

less

 

<a href="mailto:example@email.com?subject=Website Inquiry&body=Hello,">Email Me</a>


Step 7: Save the HTML file with a .html extension and open it in a web browser to test the email link.

 

That's it! You have now successfully created an email link in HTML.

 

Steps to Create an Email link in HTML with Subject and Carbon Copy (CC)

 

Sure! Follow these steps to create an email link in HTML with Carbon Copy (CC) and Subject:

 


Step 1: Open a text editor or an HTML editor like Notepad++, Sublime Text, or Visual Studio Code.

 

Step 2: Begin your HTML code by typing the <html> tag and including the <head> and <body> tags. Your code should look something like this:

 

php

 

<!DOCTYPE html>

<html>

<head>

<title>Email Link Example with CC and Subject</title>

</head>

<body>

</body>

</html>

 

Step 3: Inside the <body> tag, create a hyperlink using the <a> tag. This tag is used to create hyperlinks in HTML documents. Inside the <a> tag, include the text you want to use as the hyperlink, such as "Contact Us" or "Email Me". For example:

 

php

 

<a href="#">Contact Us</a>


Step 4: Add the "mailto" attribute to the a> tag and set its value to the email address you want to use. When the link is clicked, this tells the browser to open the default email client with a new email message addressed to the given email address. For example:

 

php

 

<a href="mailto:example@email.com">Email Me</a>


Step 5: To add a Carbon Copy (CC) field to an email link, add the "cc" parameter to the mailto link, followed by the email address you want to include as the CC recipient. For example:

 

perl

 

<a href="mailto:example@email.com?cc=examplecc@email.com">Email Me</a>


Step 6: To add a subject line to the email link, include the "subject" parameter in the mailto link, followed by the text for the subject line. For example:

 

perl

 

<a href="mailto:example@email.com?cc=examplecc@email.com&subject=Website Inquiry">Email Me</a>


Step 7: Save the HTML file with the extension.html and open it in a web browser to test the email link.


All done! You have successfully made an HTML email link with a subject and carbon copy (CC). Users can now click the email link to write a new email to the given email address. The CC recipient and subject line will already be filled in.

 

Summary of the post


Email without Subject

<a href="mailto:support@example.com"> Mail me here </a>

Email with subject

<a href="mailto:support@ example.com?subject=Subject text here"> Mail me here </a>

Email with CC and Subject

<a href="mailto:support@ example.com?cc=admin@ example.com&subject=Subject text here"> Mail me here </a>

Email with CC, Subject, and Body

<a href="mailto:support@ example.com?cc=admin@example.com&subject=Subject text here&body=This is email body"> Mail me here </a>

 

Conclusion


Putting email links on your website can make it easier for people to contact you and improve the user experience overall. Creating an email link in HTML is a simple process that involves using the "mailto" attribute in the <a> tag. By following the step-by-step instructions above, you can easily make an email link that opens the default email client and creates a new email addressed to the given email address, with an optional subject line and body text.

  

Tags