im running a win2k3 server and trying to run this formmail, but im a real newb. php currently works properly on my server, but i have never tried to use the mail function.
here is the code im using, any advice would be much appreciated!
<?
// Set page variables.
$title = "catalog Request";
$back = "";
$bg = '000000';
$text = 'ffffff';
$link = 'ffffff';
$vlink = 'ffffff';
$trans = 'spinoutin';
$btntag = 'text=000070 insetselection';
$txtbxtag = 'bgcolor=ffffff text=000070 cursor=ff autoactivate nohighlight';
// Remove < and > from the email message.
$msg = str_replace("<","",$msg);
$msg = str_replace(">","",$msg);
// Set email variables.
$your_email = 'omid@ipnt.net';
$your_name = 'oc networks';
$your_link = 'http://www.oc-networks.com';
$confirm_sub = 'We are processing your Catalog request';
$confirm_msg = "
Hello Dear $name,
Thank you for your $sub.
We will be mailing you our latest Catalog as soon as possible.
Thanks Again,
$your_name
$your_link";
$request_msg = "
You have a new Catalog Request from $name,
Street: $street
City: $city
State: $state
Zip: $zip
Email: $email";
// Begin the sendmail routine.
if ($send) {
if (!$name || !$email || substr_count($email, '@') < 1 ||
substr_count($email, '.') < 1 || !$sub) {
print <<<EOF
<html>
<title>Error!</title>
<body background="$back" bgcolor="$bg" text=$text link=$link
vlink=$vlink transition=$trans fontsize=2>
<center>
<br><br>
<font s=2 c=f0><b>
Error!</b></font>
<p>
Thank you to fill up the folowing informations:
<p>
<table>
<tr><td>
<ul>
EOF;
if (!$name) {
print "<li>Your Name<br>"; }
if (!$street) {
print "<li>Your Street Address<br>"; }
if (!$city) {
print "<li>Your City<br>"; }
if (!$state) {
print "<li>Your State<br>"; }
if (!$zip) {
print "<li>Your Zip<br>"; }
if (!$email || substr_count($email, '@') < 1 || substr_count($email, '.') < 1) {
print "<li>Your email is incorrect<br>";
}
print <<<EOF
</ul>
</table>
<p>
<a href="javascript:history.back()//">Back To Form</a>
<br><br><br><br>
</center>
</body>
</html>
EOF;
}
else {
// Email that gets sent to you.
mail($your_email, $sub, $request_msg, "From: $name < $email >");
// Email that gets sent to them.
mail($email, $confirm_sub, $confirm_msg, "From: $your_email");
// Print the thank you page.
print <<<EOF
<html>
<head><title>Your Request Has Been Sent</title>
<script>
setTimeout('history.go(-2)', 7000);
</script>
</head>
<body background="$back" bgcolor="$bg" text=$text link=$link
vlink=$vlink transition=$trans fontsize=2>
<center>
<br><br><br>
<font size=7><b>
Your Request Has Been Sent.</b></font>
<p>
Thank you Dear $name,
<br>
You will be receiving a confirmation email shortly.
</center>
</body>
</html>
EOF;
}
}
else {
// Print the contact form page.
print <<<EOF
<html>
<head><title>$title</title></head>
<body background="$back" bgcolor="$bg" text=$text link=$link
vlink=$vlink transition=$trans fontsize=2>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana;
font-size: 12px;
color: #FFFFFF;
}
body {
background-image: url(layout/catalog.jpg);
}
-->
</style>
<center>
<br>
<form method=post>
<table>
<tr><td>
Name:
<td>
<input name=name $txtbxtag size=25 maxlength=20>
<tr><td>
Street Address:
<td>
<input name=street $txtbxtag size=25 maxlength=50>
<tr><td>
City:
<td>
<input name=city $txtbxtag size=25 maxlength=50>
<tr><td>
State:
<td>
<input name=state $txtbxtag size=2 maxlength=2>
<tr><td>
Zip:
<td>
<input name=zip $txtbxtag size=5 maxlength=5>
<tr><td>
Email:
<td>
<input name=email $txtbxtag size=25 maxlength=50>
<tr><td>
Subjet:
<td>
<select name=sub width=240 $btntag>
<option selected="Catalog Request">Catalog Request
</select>
<tr><td align=center colspan=2>
<br><br>
<input type=submit name=send $btntag value="Send">
<input type=reset $btntag value="Reset">
</table>
</form>
<br>
</center>
EOF;
}
?>