Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Hosting · Guide

How to Make an Email Link in WordPress (Step by Step)

How to Make an Email Link in WordPress (Step by Step)

Short answer

Highlight the text in the block editor, click the link icon, type mailto: followed by the email address and press Enter. The same mailto format works on buttons, menu custom links and HTML anchors, and you can add a subject line with a question mark and subject parameter.

Key takeaways

  • An email link is a normal link that starts with mailto: instead of https.
  • The same format works in text, buttons, menus and HTML.
  • Add ?subject= to pre-fill the subject line, with %20 for spaces.
  • Encode the address with antispambot or a plugin to reduce spam.
  • Offer a contact form too for visitors without an email app.

Select the text in the editor, click the link icon, type mailto: followed by the email address, and press Enter; clicking it opens the visitor's email app.

That is the whole trick. A mailto link is a normal link whose address starts with mailto: instead of https://. Browsers hand it to the default email program.

You can add one in a paragraph, on a button, in a menu or in raw HTML. The format is always the same, so once you know it, you can use it anywhere WordPress accepts a link.

The scheme is defined in RFC 6068, the official standard for mailto addresses. You do not need to read it, but it is the reference if you want to know what is allowed.

Where you want the linkHow to add it
Inside a paragraphLink icon in the block toolbar
On a buttonButton block link setting
In a menuCustom link in the Navigation block or Menus screen
In a widget or footerParagraph block or Custom HTML block
In theme codeHTML anchor with antispambot()

Highlight the words you want to link, click the link icon or press Ctrl+K (Cmd+K on a Mac), type mailto:[email protected] and press Enter.

The text turns into a link right away. WordPress recognises the mailto prefix and does not try to search your site for it.

You can link the address itself or a phrase such as email our support team. Showing the actual address is often better, because people can copy it if they do not use a desktop email app.

Use your real address in place of the example. Check for typos, because a wrong letter sends messages nowhere and you will not get an error.

Step 2: Add a subject line or message body

Add a question mark after the address, then subject= and your text, using %20 for spaces, to pre-fill the email.

For example, this link opens a new email with the subject Website enquiry:

mailto:[email protected]?subject=Website%20enquiry

To add a body as well, join the parts with an ampersand:

mailto:[email protected]?subject=Quote%20request&body=Hi%2C%20I%20would%20like%20a%20quote%20for

Special characters must be encoded. Spaces become %20, commas become %2C and line breaks become %0D%0A. The MDN reference for the anchor element shows more mailto examples.

You can also add cc and bcc fields the same way, but use them sparingly. Visitors can see and change everything before they send.

Pre-filled subjects make your inbox easier to sort. A rule that files every Quote request email into one folder saves time each week.

Add a Button block, type the label, click the link icon in its toolbar and enter the mailto address.

Buttons work well for clear calls to action such as Email us on a contact page or at the end of a service page.

Our guide on how to create a button in WordPress covers adding the block.

If you need to restyle it afterwards, see how to edit a button in WordPress.

Do not set email buttons to open in a new tab. Mailto links open an email app, not a page, so a new tab often just leaves a blank window behind.

Add a Custom Link to your menu with the mailto address as the URL and a short label such as Email us.

On a block theme, go to Appearance, then Editor, open the Navigation block, click the plus icon and paste the mailto address. Then edit the label.

On a classic theme, go to Appearance, then Menus, expand Custom Links, enter the mailto address in the URL field and the menu text in Link Text, then click Add to Menu and Save Menu.

If the menu refuses to save, our fix for a menu not saving covers the usual causes, such as large menus hitting server limits.

Use a Custom HTML block or the HTML view of a block and write a standard anchor tag with a mailto address.

Here is the basic HTML:

<a href="mailto:[email protected]">[email protected]</a>

This is useful in footers, widgets and page builder HTML widgets, where you may not have a link toolbar.

In the block editor, you can also open any block's three-dot menu and choose Edit as HTML to add or check the link directly.

How do you protect the email address from spam bots?

Encode the address so bots scraping the page cannot read it easily, using WordPress's antispambot function, a small plugin or a contact form instead.

Spam bots crawl pages looking for anything shaped like an email address. A plain mailto link is easy to collect.

WordPress has a built-in helper, the antispambot function, which converts characters into HTML entities. Browsers show the normal address, but simple scrapers see a jumble.

Developers can use it in a theme or a small shortcode. For example, in a child theme's functions.php:

add_shortcode( 'email', function( $atts, $content = null ) {
    $email = antispambot( sanitize_email( $content ) );
    return '<a href="mailto:' . $email . '">' . $email . '</a>';
} );

You would then type the shortcode around the address in a Shortcode block. Test it on staging first, and keep custom code in a child theme or a code snippets plugin.

If you prefer no code, a plugin such as Email Address Encoder encodes addresses across the site automatically. Check the plugin page for current features.

Encoding cuts spam but does not stop it completely. Smarter bots can decode entities, so pair it with good spam filtering in your inbox.

Should you use a contact form instead?

Use a contact form when you want to hide your address completely, collect structured details or reach visitors without a desktop email app.

Mailto links depend on the visitor's device. On a shared or work computer with no email app set up, clicking the link may do nothing or open an app they never use.

Forms work in any browser and let you ask for exactly what you need, such as a budget or order number. Our guide on how to use Contact Form 7 is a simple place to start.

Forms bring their own spam. Our guide on stopping contact form spam covers honeypots, CAPTCHAs and filtering.

Many sites offer both. A form for most visitors, plus a visible email link for people who prefer their own inbox.

Phone links work the same way, using tel: and the full number with country code, so mobile visitors can tap to call.

For example, tel:+15551234567 opens the dialler on a phone. Remove spaces and brackets from the number in the link, though you can keep them in the visible text.

On desktop, tel links may open a calling app or do nothing, so always show the number as text too.

Some messaging apps support their own link formats. Check each app's official documentation for the correct format before adding it to your site.

The most common causes are a typo in the address, a missing mailto prefix, a visitor with no email app set up or a plugin rewriting the link.

Check the link by hovering over it. The browser's status bar should show mailto: followed by the address. If it shows your domain in front, the prefix is missing or misspelled.

If the link opens nothing on your own computer, set a default email app in your operating system settings, or set your webmail as the handler in your browser.

Some SEO and link plugins add tracking or nofollow attributes to links. That should not break mailto links, but if it does, exclude mailto addresses in the plugin settings.

Finally, make sure mail to that address actually arrives. If you set up email through your host, our guide on setting up email with WordPress hosting explains how to test it.

Frequently asked questions

What is a mailto link?

A mailto link is a link whose address starts with mailto: followed by an email address. When clicked, the browser opens the visitor's default email program with a new message addressed to you.

How do I add a subject line to a WordPress email link?

Add a question mark after the address, then subject= and your text, with spaces written as %20. For example, mailto:[email protected]?subject=Website%20enquiry opens a message with that subject already filled in.

Why does my email link open the wrong app?

The link opens whatever email app the visitor's device uses by default. Change the default email app in your operating system settings, or set your webmail as the mail handler in your browser.

Will a mailto link get my email address spammed?

A plain mailto link can be harvested by bots. Encoding the address with the antispambot function or an encoder plugin cuts this down, and using a contact form hides the address completely.

Can I make an email link in a WordPress menu?

Yes. Add a custom link with mailto: and your address as the URL, give it a label such as Email us, and save the menu. It works in both the Navigation block and the classic Menus screen.

Sources

  1. The mailto URI Scheme (RFC 6068) IETF
  2. <a>: The Anchor element MDN Web Docs
  3. antispambot() WordPress Developer Resources
  4. Email Address Encoder WordPress.org Plugins

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.