Forum Moderators: coopster

Message Too Old, No Replies

I'm Stumped - Mail() Error!

mail() error question.

         

el_chubbo

4:44 pm on Jan 9, 2007 (gmt 0)

10+ Year Member



Good Day!

I am stumped! I have a simple PHP script that runs our website feedback form. When I moved the script (and the HTML page that feeds it) to a new server the script began to crash in the middle of mail().

Instead of moving to the "thank you" header I get the following:

" $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); header( "Location: $thankyouurl" ); exit ;?>

I'm sure this is a "oh crud - I cannot believe I overlooked THAT" type of problem - but it's got me stumped :(

Any suggestions?

jatar_k

5:56 pm on Jan 9, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



can you post the lines before that as well, it looks like something is choking the parser

el_chubbo

7:28 pm on Jan 9, 2007 (gmt 0)

10+ Year Member



Here the php file from top to bottom...

A "thanks" for any suggestions you might have... (I'm going for asprin)

Matt

<?

$mailto = '#*$!@#*$!x';

$subject = "New Catalog Request." ;

$formurl = "http://shoppingcart.questaerospace.com/testshop/includes/newcatalog.htm" ;
$errorurl = "http://shoppingcart.questaerospace.com/testshop/includes/errorme.htm" ;
$thankyouurl = "http://shoppingcart.questaerospace.com/testshop/includes/thankme.htm" ;

$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 );
}

$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: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

?>

eelixduppy

9:19 pm on Jan 9, 2007 (gmt 0)



One thing I noticed. Change this:

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>".$headersep."Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );

You were missing the concatenation period before $headersep

Oh, and I almost forgot. Welcome to WebmasterWorld! :)