From the course: Validating and Processing Forms with JavaScript and PHP

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Mailing form data

Mailing form data

When you create a form to capture online data, the information you get usually has one of two destinations. The data gets sent to some email address where a human takes care of the request, or it's stored into a database. In this video, we'll look at what it takes to send an email with the result of your form. PHP has a built-in mail function which is perfect for sending the data. Here's a documentation page for mail in the php website. The mail function takes a series of strings with where to send the data, who to send it to, a subject, a message, and additional headers and parameters. PHP sends an email using the server's mail software. In Linux, this is usually called send mail. If the server is able to send the email message, then the function returns true, otherwise, it returns false. The data, as well as additional headers, adheres to certain formats as dictated by the mail protocol. Additional headers can include traditional mail features like the from address, who to replyto…

Contents