How to Link Email in HTML: My Simple Guide for Beginners

By Cristian G. Guasch •  Updated: 09/18/23 •  9 min read

If you’ve ever wondered how to link an email in HTML, you’ve come to the right place. It’s not as daunting as it may seem; in fact, it’s quite straightforward when you know the right tricks. In this article, I’ll demystify this process for you.

Linking an email in HTML is beneficial for various reasons. It provides a convenient way for your website visitors to contact you directly from your site without having to copy and paste your email address manually. This functionality enhances user experience and can lead to increased engagement on your site.

In essence, linking an email involves embedding a specific HTML tag within your web page code. But don’t worry if that sounds confusing – I’m here to guide you through each step so that even the most non-technical among us can get their head around it.

Understanding HTML and Email Integration

Diving headfirst into the world of HTML, I can’t help but marvel at its versatility, especially when it comes to email integration. It’s like a secret sauce that spices up the otherwise plain text emails. So, what’s the big deal about HTML and email integration? Let me break it down for you.

HTML (Hyper Text Markup Language) is the backbone of any webpage we see on the internet. Think of it as the skeleton that gives structure to all online content. Now, imagine extending this power to your emails. That’s right, with HTML emails you’re not just sending messages; you’re creating webpages inside an inbox!

Here’s how simple it is to add a link in an email using HTML:

<a href="">Visit our website!</a>

In this example, “” is where you’d put your website URL and “Visit our website!” is what people will see in their emails.

But why stop there? With HTML, we can do so much more than just adding links. We can style text, insert images or even include entire forms! Consider this example:

<p>Hey there,</p>
<p>Check out our new product:</p>
<img src="product.jpg" alt="Our New Product">
<a href="">Learn more</a>

This snippet sends an image of a new product along with a link for more information – all styled neatly within paragraphs.

However, while using HTML in emails provides fantastic possibilities for visual engagement and interactivity with your audience – be aware that not all email clients handle HTML well. Some might strip out certain elements or show fallbacks instead which could affect the presentation of your message.

To tackle these inconsistencies across different platforms:

The key is to test your emails across different clients before hitting “send”. By doing this, you’ll ensure a seamless experience for all your recipients.

In the end, it’s about understanding the potential of HTML and email integration, and harnessing its power to create engaging, informative content right inside an inbox. It’s not just about sending messages; it’s about delivering experiences!

Step-by-Step Guide: Linking an Email in HTML

Let’s dive right into it, shall we? Creating an email link in your HTML code is simpler than you might think. It’s all about using the right tag and structuring it correctly.

First up, you’ll need to use the <a> anchor tag. This element is most commonly used for creating links to other web pages, but did you know it’s also your ticket to creating a clickable email link?

Here’s how to do it:

<a href="">Contact us</a>

In this example, someone clicking on “Contact us” will have their default mail program open with a new message addressed to

But what if you want to pre-fill some of the email content as well? That can be achieved by adding more information within the mailto: part of your hyperlink reference.

Take a look at this:

<a href="!">Email me!</a>

In this case, “Email me!” would not only open up an email draft addressed to when clicked but also auto-fill the subject line with “Hello World” and body text as “Just saying hello!”. Note that spaces in the subject or body should be replaced with %20 for proper formatting.

Do keep in mind that while linking emails in HTML like this generally works across various browsers and devices, there could be exceptions. Some mail programs may not support parameters like subject or body. So don’t rely entirely on these features; they’re nice-to-haves rather than essentials!

It’s good practice to inform users about what will happen when they click on such a link. You could do so by adding a title to the anchor tag:

<a href="!" title="This link will open your default email client with a pre-filled message">Email me!</a>

There you have it, a simple step-by-step guide on how to create an email link in HTML. Now go ahead and give it a try!

Common Mistakes When Embedding Emails in HTML

We’ve all been there. You’re trying to embed an email link into your HTML and boom, something goes wrong. It’s a common pitfall for many of us, so let’s dive right into some of the most common mistakes when embedding emails in HTML.

One classic mistake I’ve seen time and again is not using the correct syntax for mailto links. An incorrect code might look like this: <a href="">Email Me</a>. While it seems logical, it won’t work as expected because it’s missing the “mailto:” prefix which tells the browser that this is an email link. The correct version should be: <a href="">Email Me</a>.

Another slip-up often made by beginners is including extra spaces in their mailto links, like so: <a href="mailto: myemail @ example . com">Email me</a>. Unfortunately, even though we use spaces in everyday writing to make things clearer, they can cause havoc in code. In HTML, any space within the href attribute will break the link making it unusable.

Also worth noting is how you manage subject lines and body text within your mailto links. Many don’t realize you can add these elements directly into your HTML using ?subject=Your%20Subject and &body=Your%20Body%20Text. However, if you forget to URL encode these sections (replacing spaces with %20, for instance), you’ll end up with broken links or worse – misinterpreted subjects and texts! For example: <a href=" World&body=I love coding!">Email me</a> would result in errors due to the unencoded spaces.

Lastly, let’s tackle one issue that isn’t about code, but rather usability. Many web developers forget to consider their users’ email clients. Not every user is going to have the same client, and some may not even have a default one set up on their device. When they click your mailto link, they might be greeted with an error message or an unfamiliar app opening up. It’s always worth considering alternative contact methods for those who can’t use mailto links.

I’ve seen all these mistakes and more in my time as a web developer, but I’ve also learned that everyone makes them at some point! The key is understanding where you went wrong and learning how to fix it – which is exactly what this article aims to help you do!

So, you’ve added some email links to your HTML. Now it’s time to test those out. I’ll walk you through the process step-by-step.

First off, let’s understand why testing is vital. It ensures that your email links work as expected and deliver a seamless experience for your site visitors. If a user clicks on an email link and it doesn’t function correctly, they might get frustrated and leave – not ideal when we’re trying to keep people engaged!

Before diving in, remember: always save any changes before testing. Seems obvious? You’d be surprised how often this simple step gets overlooked!

Now, onto the actual testing part:

  1. Open up your webpage where you’ve embedded the email link.
  2. Click on the email link.
  3. Verify if it opens up a new email draft in your default mail client with the To field auto-filled with the correct recipient address.

Let’s look at two examples of HTML tags used for creating an email link:

In the first example, clicking on “Email John Doe” will open up a new blank email addressed to in your default mail client.

The second example is more advanced; it includes subject and body parameters within its href. Here, clicking “Email Susan Doe” will open an email draft addressed to with subject line ‘Inquiry’ and body text ‘Hi Susan,\n\nI have some questions.\n\nThanks!’.

Remember though, not everyone’s browser or email client will behave exactly the same. It’s best to test on multiple devices and browsers to ensure compatibility.

And there you have it! With these steps, I hope testing your email links in HTML becomes a breeze.

Cristian G. Guasch

Hey! I'm Cristian Gonzalez, I created HTML Easy to help you learn HTML easily and fast.

Related articles