View Single Post

  #1 (permalink)  
Old 05-05-2008
Joker7
 
Posts: n/a
Default Help with mail script




Hi,
I use the script below to send a email from a contact form but it would be
nice if the conformed sent page showed what was sent.Question how can I do
this ?

Thanks
Chris

<?php
$mailto = 'email@mail.co' ;
$subject = "Feedback Form" ;
$formurl = "http://page.co/ of form" ;
$errorurl = "http://page.co/contact.php" ;
$thankyouurl = "http://page.co/thankyou.php" ;
$uself = 1;
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

if (!strstr($_SERVER['HTTP_REFERER'], 'page.co')) { exit ("Invalid
referrer");

}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" .
$headersep . "X-Mailer: Feed Back" );
header( "Location: $thankyouurl" );
exit ;

?>


Reply With Quote