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

General Discussion

HTML Form that sends data to Email Address

Im not familiar with PHP but I was wondering if there was a way to send data that would come from a HTML Form to an email address without using PHP?

How should I tackle this task?

2 Answers

Absolutely you can do that, and it's as simple as setting the action of the form to a mailto: address like so:

<form action="mailto:targetemail@targetdomain.com">
<!-- FORM ELEMENTS HERE -->
</form>

It's often advised against to use this method though because the user will have to have a mail client set up on their PC to deal with this link. What the link will do is open up an email that has all the data they entered.

It's best to use a server side language to deal with the data.

Marcus Parsons do the PHP courses offered by Treehouse have exercises that deal with Contact Form data sending to email address?

In the Build A Simple PHP Application course, one of the stages deals with adding a contact form to the website you create. If you have trouble with the beginning of the PHP application course, you could run through the PHP Basics course first.