1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Using the MAIL function


1 of 4

The Mail () Function
Many websites offer a way for you to send them an email from a simple form on their site. Providing the form as opposed to simply listing your email address not only looks nicer but also serves two purposes.

  1. First, the form lets the website owner decide what information it is important to collect and prompts the users to fill in the answers to each of their questions. This way the user doesn't forget to include important information.

  2. Second, if you list your email directly on your site it can be picked up by bots designed to 'farm' email addresses. What that means for you is SPAM. Nobody likes to have their inbox flooded with SPAM, and using a form can help prevent that.

The mail function is phrased as: mail (to, subject, body, headers)

An example is:

 mail ( "me@mysite.com", "Contact Us Form", "This is an email from your site", "From: you@yoursite.com" ) 
Related Video
Create Email Aliases and Forwarding Addresses in Gmail
  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Troubleshooting
  5. Using the Mail () Function in PHP - Introduction

©2014 About.com. All rights reserved.