Hello.
I am having trouble with an emailing script and any help you can offer will be greatly appreciated.
The background: A user completes a form and on ‘Send’ they are taken to a ‘Thank you’ page which also displays
exactly what will be received on the sent email. Everything works well except for the fact that no email has been sent.
I have numbered the sections of the script. If I remove sections 4,6 and 7 an email will be sent but obviously apart from
the ‘From’, ‘To’, ‘uniqid’ and ‘This is a Mime encoded message’ information nothing is sent.
I therefore believe that the problem is with sections 6 and 7.
[php] <?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);
?>
[/php]
I should tell you that I am new to this.
Thanks