Hello. I am having trouble with a script which takes input from a form, handles the submitted information and sends the results by email to email address submitted in the form. The user is then taken to a ‘Thank you’ page which also displays the sent email contents. Everything works well but for the fact that no email was sent.
If I delete sections 2,4,5,6 and 7 then an email is send which contains nothing but ‘To’ ‘From’ and ‘uniqid’.
The full script is as follows:-
[table]
[tr]
[td]
<?php
// 1 add From: header
$headers = "From: ".$fromaddress."\r\n";
// 2 specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
// 3 unique boundary
$boundary = uniqid("news");
// 4 tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" .
"; boundary = $boundary\r\n\r\n";
// 5 message to people with clients who don't understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";
// 6 plain text version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/plain; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($body2));
// 7 HTML version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/html; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($body));
// 8 send message
mail($email, $subject, "", $headers);
?>
[/td]
[/tr]
[/table]
I should point out that I am new to php.
Many thanks in advance.