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

JavaScript

Which technologies do I need to do a button that can send email to a person .

You could create two forms to get the email address and the other to get the messsage that I want to send.After , you will need a button .

But what code do I need to put in my listener? //Listener button.addEventListener("click", () => { //Code that I don't know }); Are there courses on Treehouse where we can learn that?

1 Answer

Steven Parker
Steven Parker
243,656 Points

Browsers can't send mail. So you have two choices:

  1. you can use a "mailto: address" link to bring up the user's mailer (maybe, depends on browser)
  2. you can send the form back to the server and have server code send the mail

Check the link to have a better understanding: https://www.henrikac.com/contact.php

Steven Parker
Steven Parker
243,656 Points

That link is an example of choice 2. The form is sent back to the server and the server code (contained in "send_mail.php") sends the mail.

Would you be able to create the example 2.

Steven Parker
Steven Parker
243,656 Points

I'm not sure what you mean, but I'm not a PHP developer.