hi there... i would like to know if anyone could look at my mail script and tell me if there is anything clearly wrong, or missing...
i'm planning on just using the PHP Mail() function... i'm under the assumption that it's possible to send Text and HTML emails without having to use PHP Mailer or something similar. please let me know if i'm wrong here...
thanks in advance
Code:
<?php
$to = $_POST['email'];
$subject = 'test';
$random_hash = md5(date('r', time()));
$headers = "From: me@example.com\nReply-To: me@example.com";
$headers .= "\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
ob_start();
?>
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<?php
echo nl2br ("this is a basic text email message.\nYour Email doesn't accept HTML email.");
?>
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<?php
echo ("<h2>this is an HTML email</h2>");
echo ("<p>Your email accepts <b>HTML</b> formatting.</p>");
?>
--PHP-alt-<?php echo $random_hash; ?>--
<?
$message = ob_get_clean();
mail ($to, $subject, $message, $headers);
# after message is sent, goto Google.
header ("Location: http://www.google.com");
?>
thanks in advance
Comment