Ver Mensaje Individual
  #4 (permalink)  
Antiguo 13/08/2007, 20:13
Lorsui
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 9 meses
Puntos: 1
Re: Formulario a distintos mails

Pongo los códigos que estoy manejando para que sea sobre algo más concreto mi consulta, gracias.

contact.php:
<html xmlns="http://www.dominio.com">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Formulario de Contacto</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<script type="text/javascript">
function stoperror(){
return true
}
window.onerror=stoperror
</script>
<link rel="stylesheet" type="text/css" href="/archives/examples/forms/contact/style.css" media="screen" />
</head>
<div id="contactform" style="width: 529; height: 585">
<form id="contact-form" method="post" onsubmit="return emailCheck(this.email.value);" action="email.php">
<br><b><font face="Tahoma" color="#FFFFFF">Elija a quien desea contactar:</font></b>
<select NAME="select">
<option value="mail1" SELECTED>Nombre 1</option>
<option value="mail2">Nombre 2</option>
<option value="mail3">Nombre 3</option>
<option value="mail4">Nombre 4</option>
</select>
<br><br>

<fieldset><legend><b><font face="Tahoma" size="2">Datos Personales &raquo;</font></b></legend>
<div><font face="Tahoma"><b><label for="visitorname"><span style="color:#c00;">
<font size="2"><br>
&nbsp;&nbsp;&nbsp; *</font></span><font size="2">Nombre y Apellido:<br>
&nbsp;&nbsp;&nbsp;&nbsp; </font></label>
<input type="text" name="name" id="visitorname" title="Tu Nombre" size="38" /></b></font><p>
<label for="visitormail"><b>
<font face="Tahoma" size="2" color="#CC0000">&nbsp;&nbsp; </font></b>
</label><font face="Tahoma"><b><label for="visitormail">
<span style="color:#FFFFFF;"><font size="2">&nbsp;*</font></span><font size="2"><font color="#FFFFFF">Direcci&oacute;n de correo:</font><br>
&nbsp;&nbsp;&nbsp;&nbsp; </font></label>
<input type="text" name="email" id="visitormail" value="<?php echo $email; ?>" title="Tu direcci&oacute;n de correo" size="38" /></b></font></div>
<div>&nbsp;<p><font face="Tahoma"><b><font color="#FFFFFF"><label for="subject">
<font size="2">&nbsp;&nbsp;&nbsp;&nbsp; Motivo del mensaje:</font></label><font size="2">
</font><br>
&nbsp;&nbsp;&nbsp;
<input type="text" name="sub" id="subject" title="El motivo de tu mensaje" size="38" /></font></b></font></p>
<p><font face="Tahoma"><b><label for="notes"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp; *Cuerpo del Mensaje:</font></label></b></font></p>
<p><font face="Tahoma"><b>&nbsp;&nbsp;&nbsp;
<textarea name="text" id="notes" rows="9" cols="29" onkeyup="val=this.value; if (val.length > 800) { alert('Lo siento, has sobrepasado el limite de 800 caracteres'); this.value = val.substring(0,800); } this.form.count.value=800-parseInt(this.value.length); "><?php echo $text; ?></textarea><font size="2"><br />
</font><br>
<input type="submit" id="submit" name="send" value="Enviar &raquo;" title="Pulsa una vez para enviar el mensaje, y espera a la pantalla de confirmaci&oacute;n" /></b></font></div>
</fieldset><b><font size="2" face="Tahoma"> </font></b>
</form>
<p><b><font face="Tahoma" size="2"><span style="color:#c00;">*</span>Campos Obligatorios</font></b></p>
<p><span style="color:red;font-weight:bold;"><?php echo $error ?></span></p>
<script type="text/javascript" src="var.js"></script>
</div>
</body>
</html>


send.php:

<?php

if (empty($name)) $error .= "No has introducido tu nombre"; if (empty($surname)) $error .= "No has introducido tu apellido"; if (empty($email)) $error .= "No has introducido tu direcci&oacute;n de e-mail"; if (empty($sub)) $error .= "No has introducido un titulo para el mensaje"; if (empty($text)) $error .= "No has escrito nada en el cuerpo del mensaje";$str = $text; $text_len = strlen($str); if($text_len &gt; 800) { $error .= "Lo siento, has superado el maximo de 800 caracteres en el cuerpo del mensaje. El numero total de caracteres es $text_len - por favor, acorta tu mensaje."; }
if($email) {
if(isset($_POST['email']))
{
// $email = $email;
// check to make sure email has been filled out with valid address
if (preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i',
trim($email))) {
//do nothing the syntax looks good
}
else {$error .= "Tu direcci&oacute;n de e-mail contiene un error.";
}//set error code
// check for valid domain name
$ok = TRUE;
$ok = eregi( "^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $email,
$check);
$ok = getmxrr(substr(strstr($check[0], '@'), 1), $dummy);
if($ok === false)
{
$host = substr($email, strpos($email, '@') + 1);
if(gethostbyname($host) != $host)
{
$ok = true;
}
if ($ok != true) {$error .= "La direccion de e-mail no parece correcta, por favor, compruebalo"; }
// end of check
}
}} // end of email check
if($error) {
include("index.php");
}
else {
include("email.php");
}
?>