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.
Jason AndersTreehouse Moderator 145,857 Points
I haven't done much front-end work lately, but in my opinion, and on my site, I use two approaches.
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
mailtodoesn't always work with those. This way my guest can copy/paste the email address if they need to contact me.
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
Austin Whipple29,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.