Les dejo Enviar.php
Código:
El problema, que demora mas de 20 minutos en llegarme el e-mail....<?php function esMail ($email) { if (!eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)",$email)) { return eregi("^.+\@(\[?)[a-zA-Z0-9_\-\.]+\.([a-zA-Z]{2,5}|[0-9]{1,3})(\]?)$",$email); } else { return false; } } $nombre = trim($_POST["nombre"]); $apellidos = trim($_POST["apellidos"]); $fonos = trim($_POST["fonos"]); $email = trim($_POST["email"]); $coment = trim($_POST["comentario"]); $msg_env = "Ha dejado en blanco el Nombre o el E-mail.<BR>Por favor utilize el boton atras de su navegador complete el formulario e intentelo otra vez."; if (eregi("[[:alnum:]]",$nombre) && eregi("[[:alnum:]]",$email)) { $msg_env = "Su contacto ha sido recibido"; $AsuntoMail = "Contacto desde Pagina Web w"; $ParaMail = array("MI@MAIL"); $ParaNomMail = array("Mi nombre"); if (eregi("[[:alnum:]]",$nombre) && esMail($email)) { $DeMail = $email; $DeNomMail = "$nombre $apellidos"; } elseif (esMail($email)) { $DeMail = $email; $DeNomMail = $email; } else { $DeMail = "MI@MAIL"; $DeNomMail = "Mi nombre"; } //>>>>>>>>>>>>>> PARA OBTENER ESTINATARIOS DESDE BD >>>>>>>>>>>>>> $sql = "SELECT email, nombre FROM ts_usuario WHERE r_contacto = 'S' ORDER BY nombre ASC"; if (!$db_conn_inc) { include ("admin/lib/db_conn.inc.php"); } $sth = mysql_query($sql, $dbh); $ndest = 0; if ($r = mysql_fetch_row($sth)) { $ParaMail = array(); $ParaNomMail = array(); do { $ParaMail[$ndest] = $r[0]; $ParaNomMail[$ndest] = $r[1]; $ndest++; } while ($r = mysql_fetch_row($sth)); } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $guionx70 = str_repeat("-", 70); $dia = array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado"); $mes = array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); $fecha = $dia[date("w")].", ".date("d")." de ".$mes[date("n")]." de ".date("Y")." a las ".date("H:i:s"); $MsgMail = "Recibido de su formulario de contacto.\n"; $MsgMail .= "$fecha\n$guionx70\n\n"; $MsgMail .= "Nombre : $nombre\n\n"; $MsgMail .= "Apellidos: $apellidos\n\n"; $MsgMail .= "Telefonos: $fonos\n\n"; $MsgMail .= "E-mail : $email\n\n"; $MsgMail .= "Comentarios: $coment\n\n$guionx70"; $mail_from = '"'.$DeNomMail.'"<'.$DeMail.'>'; $pcount = count($ParaMail); for ($i=0; $i<$pcount; $i++) { if ($mail_to!="") { $mail_to .= ","; } $mail_to .= '"'.$ParaNomMail[$i].'"<'.$ParaMail[$i].'>'; } $mail_subject = $AsuntoMail; $mail_body = $MsgMail; $mail_head = "From: $mail_from\r\nX-Mailer: PHP/".phpversion()."\r\n"; $mail_head .= "BCC: \"Informaciones ellicker.cl\"<[email protected]>\r\n"; $env_mail = mail($mail_to, $mail_subject, $mail_body ,$mail_head); } ?> <!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=iso-8859-1" /> <title>agrotempo/contacto</title> <style type="text/css"> <!-- body { margin-left: 30px; margin-top: 0px; } .Estilo12 {font-family: Verdana, Arial, Helvetica, sans-serif} .Estilo16 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; color: #006600; } .Estilo18 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; } .Estilo19 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color: #FFFFFF; font-weight: bold; } .Estilo20 { font-size: 12px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; } --> </style></head> <body> <table width="780" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="780" height="101" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="101" title="top"> <param name="movie" value="imagenes/barra_1.swf" /> <param name="quality" value="high" /> <embed src="imagenes/barra_1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="101"></embed> </object></td> </tr> </table> <table width="780" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td height="49" colspan="5" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="49"> <param name="movie" value="imagenes/barra2a.swf" /> <param name="quality" value="high" /> <embed src="imagenes/barra2a.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="49"></embed> </object></td> </tr> <tr> <td height="19" colspan="5" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td width="23" height="19" valign="top"><!--DWLayoutEmptyCell--> </td> <td colspan="3" valign="top"><span class="Estilo20"><?php echo $msg_env; ?></span></td> <td width="19" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="19" colspan="5" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td width="23" height="19" valign="top" bgcolor="#FFCC00"><!--DWLayoutEmptyCell--> </td> <td width="133" valign="top" bgcolor="#FFCC00"><span class="Estilo20">Datos Enviados </span></td> <td width="9" valign="top" bgcolor="#FFCC00"><!--DWLayoutEmptyCell--> </td> <td colspan="2" valign="top" bgcolor="#FFCC00"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td rowspan="9" valign="top"><!--DWLayoutEmptyCell--> </td> <td height="19" colspan="3" valign="top"><!--DWLayoutEmptyCell--> </td> <td width="19" rowspan="9" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="22" valign="top">Nombre</td> <td valign="top">:</td> <td width="596" valign="top"> <?php echo $_POST["nombre"]; ?> </td> </tr> <tr> <td height="22" valign="top">Apellidos</td> <td valign="top">:</td> <td valign="top"> <?php echo $_POST["apellidos"]; ?> </td> </tr> <tr> <td height="22" valign="top">Fono Contacto</td> <td valign="top">:</td> <td valign="top"> <?php echo $_POST["fonos"]; ?> </td> </tr> <tr> <td height="22" valign="top">e-mail</td> <td valign="top">:</td> <td valign="top"> <?php echo $_POST["email"]; ?> </td> </tr> <tr> <td height="22" valign="top">Comentario o Pregunta</td> <td valign="top">:</td> <td valign="top"> <?php echo $_POST["comentario"]; ?> </td> </tr> <tr> <td height="19" colspan="3" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="2"></td> <td></td> <td></td> </tr> </table> <table width="780" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="780" height="118" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="116"> <param name="movie" value="imagenes/barra3.swf" /> <param name="quality" value="high" /> <embed src="imagenes/barra3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="116"></embed> </object></td> <td width="4"> </td> </tr> <tr> <td height="12" valign="top" bgcolor="#339900"><div align="center"><span class="Estilo19">Todos los derechos reservados a www.agrotempo.cl </span></div></td> <td></td> </tr> </table> </body> </html>
Me gustaria que el mail, se enviase desde una direccion (por ejemplo [email protected]) hacia mi mail.