Before sending your mail, if you are using variables, you must, of course, set up the variable content beforehand. Here is some simple code for sending a message:

$to = “php@webhosting.uk.com”;
$subject = “PHP Is Great”;
$body = “PHP is one of the best scripting languages around”;
$headers = “From: webmaster@webhosting.uk.com\n”;
mail($to,$subject,$body,$headers);
echo “Mail sent to $to”;

This code will acutally do two things. Firstly it will send a message to php@webhosting.uk.com with the subject ‘PHP Is Great’ and the text:

PHP is one of the best scripting languages around

and the e-mail will be from webmaster@webhosting.uk.com. It will also output the text:

Mail sent to php@webhosting.uk.com

to the browser.