Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/06/2009, 10:40
rufus
 
Fecha de Ingreso: mayo-2009
Ubicación: Andalucia
Mensajes: 650
Antigüedad: 15 años
Puntos: 1
problema para enviar un mail con un formulario!

hola quiero que se me envie a mi correo un mail con los datos de un formulario que tiene varios campos de texto para introducir e probado estas dos formas de hacerlo pero no me funciona ninguna. paso a poner el codigo:

php 1 :

Código:
<?php

 if ($textname!="" and $textapellidos!="" and $textlocalidad!="" and $textprovincia!=""
 and $texttelefono!="" and $textfechanacimiento!="" and $textcuriculum!="")
 
  {
mail('micorreo arroba hotmalil com', 'Formulario de'.$textname.$textapellidos.$textlocalidad,$textname.$textapellidos.$textlocalidad.$textprovincia.$texttelefono.$textfechanacimiento.$textcurriculum);

 

 header('Location:paginaphp');exit();
 }
 ?>
php 2:

Código:
<?php
$mensaje=$textname.$textapellidos.$textlocalidad.$textname.$textapellidos.$textlocalidad.$textprovincia.$texttelefono.$textfechanacimiento.$textcurriculum;
 
 mail('micorreoarrobahotmailpuntocom, 'Formulario de', $mensaje);
 exit();
  ?>
y aqui el codigo javascript y el html form ke e usado:
Código:
<script type = "text/javascript" >
function formValid() {
if (document.forms[0].textname.value.length == 0) {
alert("es obligatorio introducir un nombre.");
return false;
}

if (document.forms[0].textapellidos.value.length == 0) {
alert("es obligatorio introducir sus apellidos.");
return false;
}

if (document.forms[0].textlocalidad.value.length == 0) {
alert("es obligatorio introducir su localidad.");
return false;
}

if (document.forms[0].texprovincia.value.length == 0) {
alert("es obligatorio introducir una provincia.");
return false;
}

if (document.forms[0].texttelefono.value.length == 0) {
alert("es obligatorio introducir un nombre.");
return false;
}

if (document.forms[0].textfechanacimiento.value.length == 0) {
alert("es obligatorio introducir tu fecha de nacimiento.");
return false;
}

if (document.forms[0].textcurriculum.value.length == 0) {
alert("es obligatorio introducir tu curriculum.");
return false;
}
 return true;
}
</script>
Código:
	  <form action="....php" onsubmit="return formValid();">
	  <ul>
	    <li> nombre <em>(*)</em>: 
	      <input id="textbox1" name="textname" type="text" /> 
	      </li>
	    <li> apellidos <em>(*)</em>: 
	      <input id="textbox2" name="textapellidos" type="text" /> 
	      </li>
	    <li>localidad <em>(*)</em>: 
	      <input id="textbox3" name="textlocalidad" type="text" /> 
	      </li>
	    <li> provincia <em>(*)</em>: 
	      <input id="textbox4" name="textprovincia" type="text" /> 
	      </li>
	    <li> telefono <em>(*)</em>: 
	      <input id="textbox5" name="texttelefono" type="text" /> 
	      </li>
	    <li> fecha de nacimiento <em>(*)</em>: 
	      <input id="textbox6" name="textfechanacimiento" type="text" /> 
	      </li>
	    <li>
	  curriculum <em>(*)</em>: <input id="textbox7" name="textcurriculum" type="text" /></li> </ul>
	  
	  <p> <input type="submit" value="enviar formulario"></p>
	  </form>
otro problema..uso el wampserver para tener php, mysql y servidor apache para ejecutar el php...y con el segundo codigo php que he puesto más arriba me da estos mensajes de error en el navegador:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\.........on line 4

haber si alguien me puede ayudar!!!!

gracias un saludo