Pero lo quiero utilizar ahora en otro servidor que es Windows (no se cual) y al darle al ENVIAR FORMULARIO no envia, y no muestra el mensaje de MENSAJE ENVIADO CON EXITO.
CODIGO:
Código PHP:
<?php
/*
---------------------------------------------------
SonicFog Web Development
-------------------------------------------
a division of SeniorGlobe Media Inc
-------------------------------------------
This code is Copyright Protected
SeniorGlobe Media Inc. 2005
---------------------------------------------------
*/
//This script is easy to use. Just include this page in any of your php pages and it will proccess a custom form.
//You can add as many input fields as you like to customize your form, they will all be processed.
//Settings to edit
$MailSubject = "Customer Contact"; // edit the subject of the email
$CompanyName = "My Company"; //edit - this could be a division like Support Team, this shows on the confirmation page
//change these to make your subject dropdown and handle mail routing, add as many as you like
$SubjectArray = array(
"Pre-sales" => "yournamePyourdomain.com",
"Business Proposition" => "yournamePyourdomain.com",
"Request Consultation" => "yournamePyourdomain.com",
"Other" => "yournamePyourdomain.com"
);
//enter blocked ip addresses below separated by commas
$BlockedIP = "1.1.1.1";
//enter blocked email addresses below between the quotes
$BlockedEmail = "someonePaol.com, spammerPaol.com";
//Sonic Version
$sonic_ver = "1.0.1";
//1.0.1 added security and routing
function valid_email($email)
{
// Check for a valid email address.
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,6})$";
// Get the hostname.
$fromHost = explode("@", $_POST['email']);
// Test for both valid syntax and a valid server.
if ( !eregi($regexp, $_POST['email']) || !checkdnsrr($fromHost[1], "MX") ) {
return false;
}else{
return true;
}
}
if($_POST["step"] == "send"){
$send_email = "yes";
//lets try to make it no
//no name, you can't contact us without a name
if(!$_POST["name"]){
$send_email = "no";
$error_message_name = "<center><font color=red><b>Please enter your name below.</b></font></center>";
}
//contact pref is phone but no phone number entered
if($_POST["contact_preference"] == "phone" && !$_POST["phone"]){
$send_email = "no";
$error_message_phone = "<center><font color=red><b>You chose phone as your contact preference, but
you did not enter your phone number. Please enter it now.</b></font></center>";
}
if($_POST["rc"] != $_POST["rc2"]){
$send_email = "no";
$error_message_security = "<center><font color=red><b>Your security characters did not match ours.
Please try again.</b></font><br>IP Address Logged As: $REMOTE_ADDR</center>";
}
//check for valid email format
if (!valid_email($email)){
$send_email = "no";
$error_message_email = "<center><font color=red><b>Your email address appears invalid. Please
re-enter it below.</b></font></center>";
}
//check for blocked ips
$sonicx = strstr($BlockedIP, getenv('REMOTE_ADDR'));
if($sonicx == TRUE){
$send_email = "no";
$error_message .= "<center><b>Sorry but we could not process your form at this time.</b></center>";
$error_type = "fatal";
}
$sonicxemail = @strstr($BlockedEmail, $_POST["email"]);
//echo "Post email =". $_POST["email"];
//echo "sonicxemail =". $sonicxemail;
if($sonicxemail == TRUE){
$send_email = "no";
$error_message .= "<center><b>Sorry but we could not process your form at this time.";
$error_type = "fatal";
}
if (preg_match ("/".str_replace("web", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])
&& ($send_email == "yes")){
//start formatting and building the message
// handle post strings
reset($_POST);
while(list($key, $val) = each($_POST)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$sonicMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$vala = htmlspecialchars($vala);
$sonicMessage .= "$vala, ";
}
$sonicMessage .= "<br>\n";
}else{
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")){
}else{
if ($val == ""){
$sonicMessage .= "$key: - <br>\n";
}else{
$sonicMessage .= "<b>$key:</b> $val<br>\n";
}
}
}
} // end while
//determine the mail routing
foreach($SubjectArray as $key=>$val){
if($_POST["subject"] == $key){
$MailToAddress = $val;
} //end if
} //end foreach
$sonicMessage .= "<font size=3D1><br><br>\n Sender IP: ".getenv('REMOTE_ADDR')."</font></font></body></html>";
$sonic_what = array("/To:/i", "/Cc:/i", "/Bcc:/i","/Content-Type:/i","/\n/");
$name = preg_replace($sonic_what, "", $name);
$email = preg_replace($sonic_what, "", $email);
$sonicMessage = preg_replace($sonic_what, "", $sonicMessage);
if (!$email) {
$email = $MailToAddress;
} // end if no email
$mailHeader = "From: $name <$email>\r\n";
$mailHeader .= "Reply-To: $name <$email>\r\n";
$mailHeader .= "Message-ID: <". md5(rand()."".time()) ."@". ereg_replace("web","",$_SERVER["SERVER_name"]) .">\r\n";
$mailHeader .= "MIME-Version: 1.0\r\n";
$mailHeader .= "Content-Type: multipart/alternative;";
$mailHeader .= " boundary=\"----=_NextPart_000_000E_01C5256B.0AEFE730\"\r\n";
$mailHeader .= "X-Priority: 3\r\n";
$mailHeader .= "X-Mailer: PHP/" . phpversion()."\r\n";
$mailHeader .= "X-MimeOLE: Produced By SonicFog Contact Form Ver $sonic_ver\r\n";
$mailMessage = "This is a multi-part message in MIME format.\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";
$mailMessage .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= strip_tags($sonicMessage)."\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";
$mailMessage .= "Content-Type: text/html; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= "$sonicMessage\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730--\r\n";
if(!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader)){
//everything worked but the mail function
echo "Error sending e-mail! Please try again later.";
}else{
//success message
?>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<br><span class='text'>Dear <? echo $name; ?>
<br>We have received your message below and will take appropriate action as soon as possilbe.
<br>Thank you,
<br><? echo $CompanyName; ?>
<br><br>Your Message:<br><font color=blue><? echo $message; ?>
</font>
</span>
</td>
</tr>
</table>
<?
}
}
} //end if step == send
if($_POST["step"] != "send" || $send_email == "no"){
if($error_type == "fatal"){
echo "<center><font color=red><b>".$error_message."</b></font></center>";
}else{
?>
<form method = "post" action = "<? echo $PHP_SELF; ?>">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table border="0" align="center" cellpadding="3" cellspacing="1">
<?
if($error_message_name){
?>
<tr>
<td colspan="2">
<? echo $error_message_name; ?>
</td>
</tr>
<?
}
?>
<tr>
<td align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Your name: </font></td>
<td align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="name" type="text" id="name" value="<? echo $_POST["name"]; ?>">
</font></td>
</tr>
<?
if($error_message_email){
?>
<tr>
<td colspan="2">
<? echo $error_message_email; ?>
</td>
</tr>
<?
}
?>
<tr>
<td align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Your email: </font></td>
<td align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="email" type="text" id="email" value="<? echo $_POST["email"]; ?>">
</font></td>
</tr>
<tr>
<td align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Your phone: </font></td>
<td align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="phone" type="text" id="phone" value="<? echo $_POST["phone"]; ?>">
</font></td>
</tr>
Edito: El codigo esta cortado casi al final, pero lo mas importante creo que esta... el tema de MIME.. y eso...
Gracias