Chunk1978 Posted April 14, 2007 Share Posted April 14, 2007 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... this is my first attempt at writing a mail script. <?php $name = $_POST['name']; $to = $_POST['email']; $subject = 'test'; $random_hash = md5(date('r', time())); $headers = "From: [email protected]\nReply-To: [email protected]"; $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 ("hello $name.\nthis 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 ("hello $name.<br><h2>this is an HTML email</h2>"); echo ("<p>Your email accepts <b>HTML</b> formatting.</p>"); ?> --PHP-alt-<?php echo $random_hash; ?>-- <?php $message = ob_get_clean(); mail ($to, $subject, $message, $headers); # after message is sent, goto Google. header ("Location: http://www.google.com"); ?> Link to comment https://forums.phpfreaks.com/topic/46975-mail-script-ok/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.