Ver Mensaje Individual
  #6 (permalink)  
Antiguo 25/06/2008, 17:36
piripaz
 
Fecha de Ingreso: julio-2007
Mensajes: 27
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: enviar formulario por mail

repito mi código (esta vez más limpio)

archivo1.php

<form action="gracias_vol.php" method="post" name="form2" id="form2" onsubmit="MM_validateForm('nombre','','R','tel','' ,'RisNum','mail','','RisEmail');return document.MM_returnValue">
<table width="325" border="0" align="center" bgcolor="#FBD4AB">
<tr>
<td width="88" class="style13">Nombre:</td>
<td width="287"><label>
<input name="nombre" type="text" id="nombre" size="32" />
</label></td>
</tr>
<tr>
<td class="style13">Tel&eacute;fono:</td>
<td><input name="tel" type="text" id="tel" size="32" /></td>
</tr>
<tr>
<td class="style13">Correo electr&oacute;nico:</td>
<td><input name="mail" type="text" id="mail" size="32" /></td>
</tr>
<tr>
<td class="style13">Fecha</td>
<td><input name="fecha" type="text" id="fecha" value="<?php echo gmdate("Y-m-d");?>" size="32" /></td>
</tr>
<tr>
<td class="style13">Comentarios:</td>
<td><label>
<textarea name="mensaje" id="mensaje" cols="32" rows="5"></textarea>
</label></td>
</tr>
<tr>
<td class="style13">&nbsp;</td>
<td><label>
<input type="submit" name="button" id="button" value="Enviar" />
</label></td>
</tr>
</table>
</form>



Archivo2.php


<?php
function quitar($mensaje) //elimina simbolos indeseados
{
$mensaje = str_replace("<","&lt;",$mensaje);
$mensaje = str_replace(">","&gt;",$mensaje);
$mensaje = str_replace("\'","'",$mensaje);
$mensaje = str_replace('\"',"&quot;",$mensaje);
$mensaje = str_replace("\\\\","\",$mensaje);
return $mensaje;
}
//////////////////////////////////////////////////
$to = "[email protected]";// "[email protected]"; "[email protected]"; Aca el email donde llegara el mansaje

/* subject */
$subject = "Nuevo voluntario";

/* message */
$message = "Hay un nuevo voluntario para CENFA. El nombre del contacto es: "." ". $_POST['nombre']."<br>";
$message .= "email: "." " .$_POST['mail']."<br>";
$message .= "teléfono: "." " .$_POST['tel']."<br>";
$message .= "fecha: "." " .$_POST['fecha']."<br>";
$message .= "comentario: "." " .$_POST['mensaje']."<br>";


/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers .= "To: <[email protected]>\r\n";//Aca el email donde llegara el mansaje
$headers .= "From: Mensaje Web <[email protected]>\r\n";//Aca deves poner un email del sitio
//$headers .= "Cc: [email protected]\r\n"; //este es con copia
//$headers .= "Bcc: [email protected]\r\n";// este es con copia oculta

mail($to, $subject, $message, $headers);


?>