grk101 Posted March 16, 2008 Share Posted March 16, 2008 Hi, when someone fills out a script i have. instead of sending out the reply email it says from " email@cp2.hostingcompany.com " anyone know why that would be? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 16, 2008 Share Posted March 16, 2008 what's the code look like? Quote Link to comment Share on other sites More sharing options...
grk101 Posted March 16, 2008 Author Share Posted March 16, 2008 hey this is the code.. <?php session_start(); if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) { // Receiving variables @$ip= $_SERVER['REMOTE_ADDR']; @$inqType = addslashes($_POST['inqType']); @$where = addslashes($_POST['where']); @$other = addslashes($_POST['other']); @$name = addslashes($_POST['name']); @$comments = addslashes($_POST['comments']); // Validation if (strlen($name) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid name</font></p>"); } if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($email) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } //Sending Email to form owner $subject = "Contact"; $to = "test@test.com"; $message = "Visitor's IP: $ip\n" . "name: $name\n" . "phone: $phone\n" . "email: $email\n" . "comments: $comments\n"; @mail($to, $subject ,$message ) ; //Sending auto respond Email to visitor $header = "From: test@test.com\n" . "Reply-To: test@test.com\n"; $subject = "tech support"; $email_to = "$email"; $message = "thanks"; @mail($email_to, $subject ,$message ,$header ) ; //saving record in a text file $file_name = "test.csv"; $first_raw = "inqType,where,other,name,comments\r\n"; $values = "$inqType,$where,$other,$name,".str_replace ("\r\n","<BR>",$comments )."\r\n"; $is_first_row = false; if(!file_exists($file_name)) { $is_first_row = true ; } if (!$handle = fopen($file_name, 'a+')) { die("Cannot open file ($file_name)"); exit; } if ($is_first_row) { if (fwrite($handle, $first_raw ) === FALSE) { die("Cannot write to file ($filename)"); exit; } } if (fwrite($handle, $values) === FALSE) { die("Cannot write to file ($filename)"); exit; } fclose($handle); echo("<p align='center'><font face='Arial' size='2' color='#000000'>thank you</font></p>"); unset($_SESSION['security_code']); } else { header( "Location: error.html" ); } ?> Quote Link to comment Share on other sites More sharing options...
grk101 Posted March 18, 2008 Author Share Posted March 18, 2008 i can't figure it out Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 18, 2008 Share Posted March 18, 2008 You don't indicate which mail() function is not working. Your first mail() function does not contain the extra header parameter so it will use the default settings in the php.ini for the From: address. Your second mail() function is using the extra header field, but is only using \n as the new line. Try using a specification \r\n to see if the header lines start being recognized. Quote Link to comment Share on other sites More sharing options...
grk101 Posted March 18, 2008 Author Share Posted March 18, 2008 i just tried it what you said, and when i check my inbox it still says " cp2.webhosting.com " ugh this is fraustrating lol Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.