Email links allow users to send emails directly by clicking on a link. Here’s how you can create them
To create an email link, use the <a>
tag with the href
attribute set to mailto:
followed by the email address.
<a href="mailto:info@codersmile.com">Email Us</a>
In this example, clicking "Email Us" will open the default email client with the recipient set to info@codersmile.com
.
You can also pre-fill the subject and body of the email by adding ?subject=
and &body=
parameters to the mailto:
URL.
<a href="mailto:info@codersmile.com?subject=Feedback on Codersmile&body=Hi Codersmile Team, have some feedback regarding your tutorials.">Send Feedback</a>
In this example:
subject=Feedback on Codersmile
: Sets the subject of the email.body=Hi Codersmile Team,you have some feedback...
: Sets the body of the email. represents a line break in the URL encoding.Here’s how you might integrate an email link on codersmile.com:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Us</title>
</head>
<body>
<h1>Contact Codersmile.com</h1>
<p>Have questions or feedback? <a href="mailto:info@codersmile.com">Email Us</a></p>
<p>Provide feedback directly: <a href="mailto:info@codersmile.com?subject=Feedback on Codersmile&body=Hi Codersmile Team,%0D%0A%0D%0AI have some feedback...">Send Feedback</a></p>
</body>
</html>