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 trialTravis Medeiros
4,149 PointsI was wondering how to after filling in a form and pressing the submit button to send that data to me via email.
is there a class to take or can someone point me in the right direciton.
6 Answers
Chris Jones
9,419 PointsYou can use something like php sendmail, are you using a Virtual private server or a shared hosting provider (GoDaddy or 123-Reg or similar) or are you trying locally?
Wayne Priestley
19,579 PointsHi Travis,
If you just want to have the form sent to your email address you could use the mailto action.
<form action="MAILTO:someone@example.com" method="post" enctype="text/plain">
then your form contents
</form>
Chris Jones
9,419 PointsWayne Priestley, that would still require some form of SMTP, otherwise it won't be able to get outside of the local machine/server
Wayne Priestley
19,579 PointsHi Chris,
No, not in this case. When the user fills in all the information and hits the submit button their email client opens with a pre populated email containing all the info they entered.
They just hit send and its done.
Chris Jones
9,419 PointsYep, Wayne, I agree, but I guess it all depends on what the requirements would be from the OP.
If, for example, it was a contact form, I personally think it would be a bad user experience for them to fill out a form on a website and for that to then open the systems default mail client with duplicated content.
What if the site visitor only used web based mail and doesn't have a client installed or configured?
Wayne Priestley
19,579 PointsChris,
I wouldn't use this option either for the reasons you've said, but its an option thats there. I don't have a clue what Travis intends to do with the form so I don't know if it would work for him or not.
Travis Medeiros
4,149 PointsI definitely want to avoid that bad user experience of filling out the form then a email program pops up. Is there a way to avoid the email program poping up? Can it just send the data on the form to me after they click the submit button?
Travis Medeiros
4,149 PointsSorry just read Christ Jones first post. So I may need to get into php then?
Wayne Priestley
19,579 PointsYes Travis, your going to need some sort of code such as pho to help you out.
Another option would be to use a third party form such as Machform
Travis Medeiros
4,149 PointsAny classes that you would recommend that could help me?
Wayne Priestley
19,579 PointsThere are Database courses, php & Python all on treehouse.