I am trying to write an email form in PHP and it's not working out. ANY help would be greatly appreciated!
contact.html:
<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<form method="POST" action="contact.php">
<tr>
<td>FirstName:*</td>
<td><input type="text" name="FirstName"></td>
</tr>
<tr>
<td>LastName:*</td>
<td><input type="text" name="LastName"></td>
</tr>
<tr>
<td>Address 1:*</td>
<td><input type="text" name="Street1"></td>
</tr>
<tr>
<td> Address 2:*</td>
<td><input type="text" name="Street2"></td>
</tr>
<tr>
<td>City:*</td>
<td><input type="text" name="City"></td>
</tr>
<tr>
<td>Zip Code:*</td>
<td><input type="text" name="ZipCode"></td>
</tr>
<tr>
<td>State:*</td>
<td><input type="text" name="State"></td>
</tr>
<tr>
<td>Day Telephone:*</td>
<td><input type="text" name="DayTel"></td>
</tr>
<tr>
<td>Night Telephone:*</td>
<td><input type="text" name="NightTel"></td>
</tr>
<tr>
<td>Email From:*</td>
<td><input type="text" name="EmailFrom"></td>
</tr>
<tr>
<td>Comments:*</td>
<td><textarea name="Comments" cols="50"></textarea></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Send Mail"></td>
</tr>
</form>
contact.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Street1 = $_POST['Street1'];
$Street2 = $_POST['Street2'];
$City = $_POST['City'];
$ZipCode = $_POST['ZipCode'];
$State = $_POST['State'];
$DayTel = $_POST['DayTel'];
$NightTel = $_POST['NightTel'];
$EmailFrom = $_POST['EmailFrom'];
$Comments = $_POST['Comments'];
if (eregi('http:', $Comments)) {
die ("Do NOT try that! ! ");
}
if(!$EmailFrom == "" && (!strstr($EmailFrom,"@") || !strstr($EmailFrom,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($FirstName) || empty($LastName) || empty($Street1) || empty($City) || empty($State) || empty($ZipCode) || empty($DayTel) || empty($NightTel) || empty($Comments)) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
$todayis = date("l, F j, Y, g:i a");
//$attn = $attn;
$subject = "You have an email from your website";
$Comments = stripcslashes($Comments);
$message = " $todayis [EST] \n
Name: $FirstName $LastName \n
Email: $EmailFrom \n
Address 1: $Street1 \n
Address 2: $Street2 \n
City: $City \n
State: $State \n
Zip Code: $ZipCode \n
Daytime Telephone: $DayTel \n
Nighttime Telephone: $NightTel \n
Comments: $Comments \n
=========================
Additional Info: IP = $ip \n
Browser Info: $httpagent \n
Referral: $httpref \n
";
$from = "From: $EmailFrom\r\n";
$visitor = "$FirstName $LastName";
[b]mail("email@address.com", $subject, $message, $from);[/b]
?>
<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $EmailFrom ?> )
<br />
Address 1: <?php echo $Street1 ?>
<br />
Adress 2: <?php echo $Street2 ?>
<br />
City: <?php echo $City ?>
<br />
State: <?php echo $State ?>
<br />
Zip Code: <?php echo $ZipCode ?>
<br />
Daytime Telephone: <?php echo $DayTel ?>
<br />
Nighttime Telephone: <?php echo $NightTel ?>
<br />
Comments:<br />
<?php $notesout = str_replace("\r", "<br/>", $Comments);
echo $notesout; ?>
<br />
<?php echo $ip ?>
<br /><br />
<a href="index.html"> Home Page </a>
</p>
</body>
</html>
Error message:
Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\4524320\html\Site\contact.php on line 75 Line 75 listed with [b]-[/b] in contact.php.
Thank you in advance for any help you can offer me.
The Rock

New Topic/Question
Reply




MultiQuote





|