Welcome to the Treehouse Community
Looking to learn something new?
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,704 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,712 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.