From the course: Learning PHP

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Sending the form data in an email

Sending the form data in an email - PHP Tutorial

From the course: Learning PHP

Start my 1-month free trial

Sending the form data in an email

- [Instructor] Once you have your data nice and valid, it's time to do something with it. A common action is sending it via email somewhere. Let's take a look at how to do that now. For simplicity's sake, again, we're going to use a blank process.PHP file, and we're going to assume all of our data has been validated and sanitized. We want to focus on using the mail function in PHP right now. And the easiest way to send email via PHP is the mail function. The mail function accepts several arguments, but the first three are required. It's a two email address where we are sending the message, a subject line, and then the actual body of the email. So let's look at those first. First, let's put together the message, and we're actually going to use some code that we saw in a previous video. You can find this code in the eight three exercise files. But this is going to do everything we need it to do except instead of echo,…

Contents