About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > Email - Basics...

   Browse by title articles:
   What is hot:

Date

File Permissions

File Open and Close

Creating Directories

Email - Basics

Email - Multiple Recipients

Strings - Pulling apart
Top 10 Biggest Mistakes of Website Design
File Open and Close
A Sticky Website
Prev articles12345678910 11 12Next articles



Email - Basics


Computer & I'net articlesEmail - Basics

by David Stanley    



PHP makes sending information to an email rather easy. It takes one main command :

mail ("recipient","subject","message");

The first value is an email address. Where the information is going to be sent to.

The second value is a short sentense or note. It will appear in the SUBJECT field of the email.

The third value is the main body message. 

Values can be entered directly into the mail command.

<?php
mail("yourplace@somewhere.com","My email test.","Hello, how are you?");
?>

Many people prefer to use variables to pass the information into it.

<?php
$to = "yourplace@somewhere.com";
$subject = "My email test.";
$message = "Hello, how are you?";

mail($to,$subject,$message);
?>

To know if the email was successfully sent out, an IF command can be used on the mail command. The mail command produces a positive result upon success.

<?php
$to = "yourplace@somewhere.com";
$subject = "My email test.";
$message = "Hello, how are you?";

if ( mail($to,$subject,$message) ) {
   echo "The email has been sent!";
   } else {
   echo "The email has failed!";
   }
?>

The further email tutorial pages will build onto this example. Change the values to your own, save it it as a php file, upload and test it on your hosted space. Viewing the page, the script will automatically go and send an email. If it works, you are ready to continue further.




-----------------
Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.





Group Work




  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com