Search Help Board

PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


Previous Page Page 2 of 2  

Advanced Example

Here we will show the full capabilities of the PHP mail function.

PHP Code:


echo "<html><body>";

$recipient = "Kris Arndt <[email protected]>,[email protected]";
$subject = "Testing the mail function";
$message = "Hello!\n\nThis is the body of the message.\n\n";
$extra = "From: [email protected]\r\nReply-To: [email protected]\r\n";

mail ($recipient, $subject, $message, $extra);

echo "Sending mail...";
echo "</body></html>";


We send an email to two people this time, by putting two email addresses in the recipient field and separating them with commas.

The fourth parameter holds extra headers for the email.  We specify who the email was from and who the recipient should reply to.  When entering multiple headers, separate them with the line feed and new line combination ('\r\n').

Previous Page Page 2 of 2