Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


What is the best practice for putting email on website? Mailto: still acceptable?

I have built a website but wanted to know how people are coding the site to include their email. It appears the mailto: approach does not help fight spam.

2 Answers

Jason Anders
Jason Anders
Treehouse Moderator 145,857 Points

Hey Mindy,

I haven't done much front-end work lately, but in my opinion, and on my site, I use two approaches.

  1. I include my email as text-only in the footer of the homepage. I just found that many people are using 3rd party mail sites (eg. gmail, yahoo, live, etc) and the mailto doesn't always work with those. This way my guest can copy/paste the email address if they need to contact me.

  2. I have a "Contact Me" page that uses a form and 3rd party mail client. This way the guest just fills out the form, and I get the email.

I employ both, but it is really dependent on what kind of site you have and what you want.

Hope that helps :dizzy:

Thanks for the answer Jason. I just wanted to make sure I was going in the right direction.
Have a great day.

Austin Whipple
Austin Whipple
29,725 Points

mailto: is still technically acceptable. You are, however, definitely opening yourself up to spam email address harvesters (not like there already isn't enough spam out there, but better safe than sorry).

Ideally, you'd create a web form with CAPTCHA or some other method of preventing robots from submitting the form automatically and repeatedly. Unfortunately, this does require some knowledge of server-side scripting (PHP, Python, Node.js, etc.). The good news is that it's not a particularly complicated script and you can find plenty of tutorials floating around the web.

Thanks Austin, with your answer and Jason it confirms what I was thinking and have gathered from different forums. Thanks again!