Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/09/2010, 04:19
twix89
 
Fecha de Ingreso: septiembre-2010
Mensajes: 5
Antigüedad: 13 años, 7 meses
Puntos: 0
PROBLEMA mail php

Hola, tengo un probelma ie s que quiero hacer que un formulario se envie a un mail pero no me lo envia, i e mirdao los datos i los muestra todos bien,i mi codigo es el siguiente:

<?

if($accio=="enviar_form"){

$nombre = $_POST['f_nombre'];
$direccion = $_POST['f_direccion'];
$localidad = $_POST['f_poblacion'];
$provincia = $_POST['f_provincia'];
$cp = $_POST['f_cp'];
$telefono = $_POST['f_telefono'];
$email = $_POST['f_email'];
$comentarios = $_POST['f_comentarios'];
$eventos= $_POST['f_eventos'];


$subject = "Zimmer - Formulario contacto";
$text = "Formulario de contacto:

Datos de la persona solicitante:
Nombre: $nombre
Dirección: $direccion
Población: $localidad
Provincia: $provincia
CP: $cp
Teléfono: $telf
E-mail de contacto: $email

Comentarios: $comentarios";

$to = "[email protected]";

enviar_mail($subject,$text,$to,$email,$nombre);

//doy las gracias por el envío
//echo "Gracias por rellenar el formulario. Se ha enviado correctamente.";
//echo $text;

header("Location: $PHP_SELF");
exit;
}

function enviar_mail($subject,$body,$to,$from="zimmerdental @zimmerdental.es",$nom_from="Zimmer Dental Ibérica"){
$from = str_replace("\r", "", $from);
$from = str_replace("\n", "", $from);
$find = array("/bcc\:/i",
"/Content\-Type\:/i",
"/Mime\-Type\:/i",
"/cc\:/i",
"/to\:/i");
$from = preg_replace($find,"",$from);

$headers.= "From: $nom_from <$from>\r\n";
$headers.= "X-Mailer: Microsoft Office Outlook, Build 11.0.6353\r\n";

mail($to,$subject,$body,$headers);
}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Formulario de inscripción</title>
<script language = "Javascript">
/**
* DHTML resetear formulario. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
*/

function validar2(formqs) {
var emailRegEx = /^(.+\@.+\..+)$/

var numericoRegEx = /^\d*$/

if(formqs.f_nombre.value == "") {
formqs.f_nombre.focus();
mostrar("El campo 'Nombre' es obligatorio!");
return false;
}
if(formqs.f_email.value == "") {
formqs.f_email.focus();
mostrar("El campo 'Email' es obligatorio!");
return false;
} else {
if(!formqs.f_email.value.match(emailRegEx)) {
formqs.f_email.focus();
formqs.f_email.value = "";
mostrar("Debe ingresar una direccion de email valida.");
return false;
}
}
if(formqs.f_telefono.value == "") {
formqs.f_telefono.focus();
mostrar("El campo 'Telefono' es obligatorio");
return false;
}
else if(formqs.f_telefono.value !== "") {
if(!formqs.f_telefono.value.match(numericoRegEx)) {
mostrar("El campo 'Telefono' solo puede contener numeros.");
formqs.f_telefono.focus();
formqs.f_telefono.value = "";
return false;
}
}
if(formqs.f_direccion.value == "") {
formqs.f_direccion.focus();
mostrar("El campo 'Direccion' es obligatorio!");
return false;
}
//if(form.pais.value == "") {
//form.pais.focus();
//mostrar("El campo 'Pais' es obligatorio!");
//return false;
//}
if(formqs.f_provincia.value == "") {
formqs.f_provincia.focus();
mostrar("El campo 'Provincia' es obligatorio!");
return false;
}
if(formqs.f_cp.value == "") {
formqs.f_cp.focus();
mostrar("El campo 'Codigo Postal' es obligatorio");
return false;
}
else if(formqs.f_cp.value !== "") {
if(!formqs.f_cp.value.match(numericoRegEx)) {
mostrar("El campo 'Codigo Postal' solo puede contener numeros.");
formqs.f_cp.focus();
formqs.f_cp.value = "";
return false;
}
}
if(formqs.f_poblacion.value == "") {
formqs.f_poblacion.focus();
mostrar("El campo 'Poblacion' es obligatorio!");
return false;
}
return true;
}

function mostrar(error) {
document.getElementById('Errores').innerHTML = error;
document.getElementById('Errores').style.backgroun d = "#ffcccc";
}

function ResetForm(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
switch (tempobj.type)
{
case "text":
case "textarea":
eval(tempobj.value="")
break;
case "radio":
case "checkbox":
eval(tempobj.checked=0)
break;
case "select-one":
eval(tempobj.selectedIndex=tempobj.defaultSelected )
break;
}
}
}
return false
}
</script>

</head>
<body>

<form action="<? echo $PHP_SELF ?>" name="formqs" onsubmit="return validar2(this)" onReset="return ResetForm(this);" method="post" >
<br>

<table width="350" cellpadding="7" align="center" border=1 bgcolor="#3399ff">
<tr>
<td align=center bgcolor="#3399ff"><img src="logozimmer.gif"></td>

</tr>
<tr>
<td bgcolor="#EEEEEE">

<table>
<tr align="center">
<td colspan="2" style="padding=5px"></td>
</tr>
<tr><td colspan="2" id="Errores"></td></tr>
<tr><td valign='top'><div align="left"><b class="texto"><font color="red">*</font>Nombre y apellidos</b><br><input name="f_nombre" type="text" id="f_nombre" size="50" value="" ></div></td></tr></table><table><tr><td valign='top'><div align="left"><b class="texto"><font color="red">*</font>Dirección</b><br><input name="f_direccion" type="text" id="f_direccion" size="50" value="" ></div></td></tr></table><table><tr><td valign='top'><div align="left"><b class="texto"><font color="red">*</font>CP</b><br><input name="f_cp" type="text" id="f_cp" size="5" value="" ></div></td><td valign='top'><div align="left"><b class="texto"><font color="red">*</font>Población</b><br><input name="f_poblacion" type="text" id="f_poblacion" size="20" value="" ></div></td><td valign='top'><div align="left"><b class="texto"><font color="red">*</font>Provincia</b><br><input name="f_provincia" type="text" id="f_provincia" size="20" value="" ></div></td></tr></table><table><tr><td valign='top'><div align="left"><b class="texto"><font color="red">*</font>Teléfono</b><br><input name="f_telefono" type="text" id="f_telefono" size="15" value="" ></div></td><td valign='top'><div align="left"><b class="texto"><font color="red">*</font>E-mail</b><br><input name="f_email" type="text" id="f_email" size="20" value="" ></div></td></tr></table><table><tr><td valign='top'><div align="left"><b class="texto">Comentarios</b><br><textarea name="f_comentarios" id="f_comentarios" cols="40" rows="5"></textarea></div></td></tr></table><table><tr><td valign='top'><div align="left"><b class="texto">Evento</b><br><input name="f_eventos" type="text" id="f_eventos" size="50"></textarea></div></td></tr></table> <br>

<div align="right">Los campos marcados con (<font color="red">*</font>) son OBLIGATORIOS</div>


<tr>
<td bgcolor="3399ff">
<table width="100%">
<tr>
<td align="left">
<input type="reset" value="Borrar" name="borrar";> </td>
<td nowrap align="right">
<input type="submit" value="Enviar" name="enviar">
<input name="accio" type="hidden" id="accio" value="enviar_form">
</td>

</tr>
</table>

</td>
</tr>
</table>
</table>
</form>


</body>
</html>