O'Reilly logo

PHP for Teens by Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic Email Commands

If you wish to send email through an HTML form, a very simple method is to use the mail() function built into PHP. Mail() gives the ability to send out a very basic email with a to address filled in. In addition, you can have a subject and a message inside the email. Let’s look at a basic email declaration.

Notice that it seems like you cannot choose to change who the message is from. Actually, you can. Just choose one of these methods:

  • Define it manually within the $additionalheaders variable.

  • Go into your php.ini file from your PHP installation and configure the from address directly in the file.

Because the web server is handling part of the sending, the from option on the email will be from the web server.

Note

The web ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required