I was trying to use a script from the Core PHP book by Atkinson. Listing 24-7 tosses me a 500 Internal Server Error -
Apache/2.0.45 (Win32) Server at localhost Port 80
I can get other email to send from my PHP setup and this is the frist time I have ever hit this kind of an error.
Can anyone advise what is amiss?
Here is the code:
<?php
//add From: header
$headers = "From: me@mind.net\r\n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
//unique boundary
$boundary = uniqid("COREPHP");
//tell e-mail client this e-mail contains
//alternate versions
$headers .= "Content-Type: multipart/alternative" .
"; boundary = $boundary\r\n\r\n";
//message to people with clients who don't
//understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";
//plain text version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/plain; charset=UTF-7\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode(
"This is the plain text version!"));
//HTML version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/html; charset=UTF-7\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode(
"This the <b>HTML</b> version!"));
//send message
mail("me@mind.net", "An HTML Message", "", $headers);
print("HTML Email sent!");
?>