HTML

Email Links


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.

Example:

<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.

 

Adding Subject and Body

You can also pre-fill the subject and body of the email by adding ?subject= and &body= parameters to the mailto: URL.

Example:

<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.

 

Best Practices

  • Clear Call to Action: Use descriptive text like "Email Us" or "Send Feedback" to encourage users to click.
  • Accessibility: Ensure the email address is correctly formatted and accessible to all users.
  • Privacy Considerations: Avoid pre-filling sensitive information in the email body for security reasons.

Example HTML Code

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>