How to Link an Email Address in WordPress
Of course lots of people like to use contact forms on their site. But there may be situations where you’d want to provide a linked email address too, either showing the actual email address (like [email protected]) or some text of your choosing (like contact me).
Doing either is pretty easy. You just need to know the simple code.
Creating Email Links
Creating email links is basically just like making a regular link, but instead of putting http:// in front, you would use mailto:
The complete HTML for the above would be the following …
<a href="mailto:[email protected]">My Link Text</a>
Of course if you wanted to show the email address itself (but still link to it), the HTML would look like this …
<a href="mailto:[email protected]"> [email protected] </a>
You could even use the link function in the WordPress editor to help you build your links. A normal link is created with http:// …
When that pops up, just delete the http:// and use mailto: instead.
You can also pre-populate the email with a subject line by appending information after the email address like this (beginning with the question mark):
<a href="mailto:[email protected]?Subject=Hello%20There!">My Link Text</a>
(Note: the characters “%20” above gives you a space between the two words “Hello” and “There!”)
What About Spam?
Of course when you put your email address out there so nakedly, you may be opening yourself up to more spam.
In order to combat that, there are email encoder plugins you can use. There are some who question the effectiveness of such encoding (depending on what type it is). And spammers are adjusting all the time, so it’s matter of staying ahead of them. But some have found success with such plugins. You can test them out yourself.
One such plugin is the Email Encoder Bundle. While this plugin comes with a number of different options, including a form that will help you generate your email links, it will automatically go into action when activated, encoding mailto links like those above into gibberish.