Recently one of our readers asked us how to add an email address in WordPress? Creating a link to an email address allows users to send you an email with a click. In this article, we will show you how to link to an email address in WordPress.
Creating a Link to an Email Address in WordPress
Adding a link to an email address is very much like adding other links in WordPress. Take a look at our guide on how to add a link in WordPress.
When adding a link to any other web page, you usually add
https:// followed by rest of the url. For example,
Similarly when adding a link to an email address, you need to replace the http part with mailto: prefix followed by the email address you want to link to. Here is a example:
Here is how you will add it in a WordPress post.
Select the text you want to add the link to and then press CTRL+K (Command+K on Mac) or click on the ‘Insert Link’ button in the post editor.
This will bring up the insert link popup where you need to add your mailto link. Click on the apply button to close the insert link popup.
As you can see in the animation above, we added a link to an email address. WordPress will automatically detect that the text you are trying to link is an email address and will add the mailto: prefix to the email address.
You can add an email link to any text. If the text is not a valid email address then you will need to add your complete link. Like this:
How to Manually Add an Email Link in WordPress Using HTML
If you want to add an email link in a text widget or a WordPress theme file, then you will need to add link by writing the HTML.
Here is how you will add an email link using HTML:
<a href="mailto:firstname.lastname@example.org">Email Me</a>
Why You Should Avoid Adding Email Links in WordPress Posts and Pages?
The downside of adding an email link is that the email address becomes publicly visible. This allows email scraping bots to collect it, which means you will get tons of spam on those email addresses.
Another disadvantage is that users are less likely to switch applications (from browser to their email client) to send an email. Most users may not want to use their primary email address to send out emails.
You can easily avoid this by adding a contact form instead of adding an email link.
See our step by step tutorial on how to create a contact form in WordPress.
Another way to beat email bots is by encoding email addresses. Check out our tutorial on how to protect emails from spammers with WordPress email encoder.
We hope this article helped you learn how to link to an email address in WordPress. You may also want to see our guide on 14 tips for mastering the WordPress visual editor.
READ THE ORIGINAL ARTICLE HERE: How to Link to an Email Address in WordPress