Jump to content

PHP form to MAIL issues


GregL83

Recommended Posts

Hello, I am adding a PHP form to mail script to my contacts page of my website. I used a script generator from thesitewizard.com; however, I am getting an error message when I try and test it out. The message is as follows:
"The server encountered an unexpected condition which prevented it from fulfilling the request.
The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log."
I can't find the error log or seem to be able to fix the problem. My web host is powweb and they have: PHP4 & PHP5 w/Zend Optimizer, Perl5, Sendmail listed as supported software.
here is my .php file's code:
<?
$mailto = '[email protected]' ;
$subject = "YourScene Message" ;
$formurl = "http://www.***.us/contact.html" ; //note I blanked out website for privacy, thanks
$errorurl = "http://www.***.us/contact_error.html" ;
$thankyouurl = "http://www.***.us/contact_thanks.html" ;
$uself = 0;
$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 ;
?>

Here is my code from the form:
<form action="data/contact.php" method="post" name="Comments" id="Comments"><div align="center">
<p><span class="style3">Full Name:</span>
<input name="name" type="text" id="full_name" maxlength="25">
<span class="style3">Email:</span>
<input name="email" type="text" maxlength="25">
</p>
<p><span class="style3">Message</span><br>
<textarea name="comments" cols="50" rows="7"></textarea>
</p>
</div>
</label>
<label> </label>
<div align="center">
<input name="Submit" type="submit" value="Send">
<input type="reset" name="Submit2" value="Reset">
</label>
</div>
<label></label>
</form></td>


PLEASE HELP!!!! Thank you for your time!
Link to comment
https://forums.phpfreaks.com/topic/12639-php-form-to-mail-issues/
Share on other sites

Try just changing this:[code]mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );[/code]

to this[code]mail($mailto, $subject, $messageproper,"From: \"$name\" <$email>);[/code]
[!--quoteo(post=386902:date=Jun 22 2006, 12:28 PM:name=cmgmyr)--][div class=\'quotetop\']QUOTE(cmgmyr @ Jun 22 2006, 12:28 PM) [snapback]386902[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Try just changing this:[code]mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );[/code]

to this[code]mail($mailto, $subject, $messageproper,"From: \"$name\" <$email>);[/code]
[/quote]

ya simple is sometimes better!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.