PHP send mail form needs to be in ASP
Code:
<?php
// - if not you do not use these var names or add different fields you must change these variables (i.e - $name/$email) to correspond to your flash vars and or add extra php variable names.
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$name=trim($name);
$email=trim($email);
$subject=StripSlashes($subject);
$message=StripSlashes($message);
///////////////////////////////////////////////////////////////////
//modify the next line with your own email address
$toaddress='[email protected]';
//defining extra attributes for auto response email, sent to sender
$adminaddress = "[email protected]";
$siteaddress ="http://www.your_site.com";
$sitename = "your_site_name";
$who = "you";
// - gets the date and time from local server
$date = date("m/d/Y H:i:s");
// - gets the composers IP address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
///////////////////////////////////////////////////////////////////
// - check that a valid email was entered
function validate_email($email) {
// - check for a invalid/false email address
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
// it failed the format test, so return with an invalid address error
return 1;
} else {
//if it didnt fail it passed
return 0; // send mail
}
}
// calls the email that was provided and parses it in the validate function
$valid = validate_email($email);
//defines the case value we have set 0 - send mail || 1 - invalid email || 2 - server error
switch ($valid) {
///////////////////////////////////////////////////////////////////
// the email that you will recieve that your visitor composes
case 0:
mail ($email,$subject,
"** This is an submission generated from the tutorial contact form from $sitename** \n
$name visiting $sitename had an inquiry. Information below....\n
- Name: $name
- Email: $email\n
- $name has left these details....
------------------------------
- Subject: $subject
- Message: $message
------------------------------
\n
Logged User Info :
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","From: $name <$email>") ;
///////////////////////////////////////////////////////////////////
// the email that the visitor will recieve immediately
mail ($email,"Thank You for your recent inquiry with $sitename",
"$name,\n
Thank you for inquiring with $sitename.\n
We will be looking into your request within the next hour, and
be in contact shortly.\n
Sincerely,
$who
$siteaddress","FROM:$adminaddress") ;
// all good - play the send frame
echo 'response=passed';
break;
// invalid email address - play invalid frame
case 1:
echo 'response=invalid';
break;
}
?>
I have used this PHP mail form for a long time, and now I have a client that is on a windows server and thier "php rendering" softwarre does not work very well. So I am put in a bad spot. I can not find any good asp contact forms to use and I do not know asp worth anything. So is there someone that had something similar, or can convert this, or link me to one that works?
Any help you can provide will be greatly appreciated. Thanks !