Send Mail in PHP

Using the PHP Mail function is the simplest method to send email through PHP.

The code below gives a basic example of the syntax and use of the PHP mail function.

$message = $_REQUEST['message'] . "\n\n\n";
$message .= $_REQUEST['name'] . "\n" . $_REQUEST['email'];

mail('someone@somewhere.com',
"You are a winner!",
$message,
"From: {$_REQUEST['email']}\r\n");

Sending mass e-mails using the PHP mail function is neither elegant or recommended. There are a few scripts out on the web that will help with this, some commercial, some free.