aqui dejo el fla.
Código :
//Para que cuando el usuario pulse el tabulador, "TAB"
_root.CartelEntero.nombre.tabIndex = 1;
_root.CartelEntero.email.tabIndex = 2;
_root.CartelEntero.textos.tabIndex = 3;
_root.CartelEntero.enviar.tabIndex = 4;
//fin de funcion
//aqui importamos la clase alert
import mx.controls.Alert;
_root.CartelEntero.nombre.onSetFocus=function(){
this.text="";
}
_root.CartelEntero.email.onSetFocus=function(){
this.text="";
}
//variables para la fecha
var mifecha:Date= new Date();
var meses:Array=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
anyo=mifecha.getFullYear()
diames = mifecha.getDate()
mes=mifecha.getMonth();
digitosanyo=mifecha.getFullYear();
//esto es para que en un campo de texto dinamico salga la fecha
_root.CartelEntero.fecha.text= diames+" de "+ meses[mes] +" de "+digitosanyo
//ahora empezamos el boton enviar
_root.CartelEntero.Enviar.onPress = function (){
if ((CartelEntero.nombre.text=="")||(CartelEntero.nombre.text=="Nombre")||(CartelEntero.email.text=="")||(CartelEntero.email.text=="Tu e-Mail")||(CartelEntero.texto.text="")){
Alert.buttonHeight = 22;
Alert.buttonWidth = 100;
// Mostrar cuadro de diálogo de alerta.
Alert.show("Falta rellenar datos", "Envio de e-Mail", Alert.OK);
trace("deberia salir la alerta")
}else{
//ahora formaremos el envio para php, imaginemos que es un camion con todos los paquetes
var camion:LoadVars = new LoadVars()
camion.user= _root.CartelEntero.nombre.text
camion.email= _root.CartelEntero.email.text
camion.texto = _root.CartelEntero.textos.text
camion.fecha = _root.CartelEntero.fecha.text
camion.sendAndLoad("email.php",camion,"post")
camion.onLoad=function(){
var Respuesta:String = camion.respuesta
if ( camion.respuesta == "Ok"){
_root.CartelEntero.nombre.text=""
_root.CartelEntero.email.text=""
_root.CartelEntero.textos.text="Mensaje enviado con éxito, Revisa tu correo porque en breves momentos recibirás un justificante, si pasados 5 minutos no lo has recibido, mira en tu buzón de correo no deseado. Si tampoco lo encuentras en Correo No Deseado, mandanos otro mensaje, puede fallar el servidor. Gracias, y disculpe las molestias."
}else{
_root.CartelEntero.nombre.text=""
_root.CartelEntero.email.text=""
_root.CartelEntero.textos.text="Error al enviar el mensaje."
}
}
}
}
_root.CartelEntero.Borrar.onPress=function (){
_root.CartelEntero.nombre.text="Nombre"
_root.CartelEntero.email.text="Tu e-Mail"
_root.CartelEntero.textos.text=""
}
Ahora vamos a poner la parte de php
Código :
<?php
$boundary = md5(time().rand(1,100));
$email = $_POST["email"];
$textoMensaje = $_POST["texto"];
$message = '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Formulario De PCM Webs</title>
<style type="text/css">
<!--
body {
background-color: #9797FF;
}
.Estilo2 {
font-size: 18px;
font-weight: bold;
}
.Estilo5 {font-size: 16px}
-->
</style></head>
<body>
<table width="100%" border="0">
<tr>
<td align="left" valign="top" bgcolor="#9797FF"><h1>Formulario De PCM Webs </h1></td>
<td width="48%" align="right" valign="top" bgcolor="#9797FF"><img src="http://www.pcmwebs.es/img/PcmWebs.png" alt="PCM Webs" width="264" height="139" longdesc="PCM Webs - Diseño y creación de páginas y aplicaciones Web" /></td>
</tr>
<tr>
<td colspan="3" align="left"><table width="100%" border="0">
<tr>
<td width="15%" align="left"><span class="Estilo2">Email recibido el:</span></td>
<td width="85%" align="left"><span class="Estilo5">'.$_POST["fecha"].'</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="0">
<tr>
<td width="4%" align="left"><span class="Estilo2">Por:</span></td>
<td width="89%" align="left">'.$_POST["user"].'</td>
<td width="7%"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="left"><table width="100%" border="0">
<tr>
<td align="left"><span class="Estilo2">El usuario escribio el siguiente mensaje :</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="left"><table width="100%" border="0">
<tr>
<td align="left"><span class="Estilo5">'.$_POST["texto"].'</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0">
<tr>
<td width="26%" align="left"><span class="Estilo2">Desde la siguiente direccion ip:</span> </td>
<td width="74%" align="left">'.$REMOTE_ADDR.'</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0">
<tr>
<td width="21%" align="left" class="Estilo2">Su direccion de email es: </td>
<td width="79%" align="left">'.$_POST["email"].'</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="0">
<tr>
<td width="41%" align="left" class="Estilo2">El numero de serie asignado por el ordenador es: </td>
<td width="59%" align="left"><span class="Estilo5">'.$boundary.'</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="0">
<tr>
<td width="67%"> </td>
<td width="33%" align="right">Si desea visitar el sitio Web Pulse <a href="http://www.pcmwebs.es" target="_blank">Aquí</a> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>';
$sendTo = "[email protected]";
$subject = "Formulario De PCM Webs";
$headers = "MIME-Version: 1.0\nContent-type: text/html; charset=UTF-8\nFrom: $user < $email >";
mail($sendTo, $subject, $message, $headers);
$message2 = '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Formulario De PCM Webs</title>
<style type="text/css">
<!--
body {
background-color: #9797FF;
}
.Estilo2 {
font-size: 18px;
font-weight: bold;
}
.Estilo5 {font-size: 16px}
-->
</style></head>
<body>
<table width="100%" border="0">
<tr>
<td align="left" valign="top" bgcolor="#9797FF"><h1>Formulario De PCM Webs </h1>
<p>Confirmacion de correo </p></td>
<td width="48%" align="right" valign="top" bgcolor="#9797FF"><img src="http://www.pcmwebs.es/img/PcmWebs.png" alt="PCM Webs" width="264" height="139" longdesc="PCM Webs - Diseño y creación de páginas y aplicaciones Web" /></td>
</tr>
<tr>
<td colspan="3" align="left"><table width="100%" border="0">
<tr>
<td width="15%" align="left"><span class="Estilo2">Email recibido el:</span></td>
<td width="85%" align="left"><span class="Estilo5">'.$_POST["fecha"].'</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="0">
<tr>
<td width="4%" align="left"><span class="Estilo2">Por:</span></td>
<td width="89%" align="left">'.$_POST["user"].'</td>
<td width="7%"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="left"><table width="100%" border="0">
<tr>
<td align="left"><span class="Estilo2">El usuario escribio el siguiente mensaje :</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="left"><table width="100%" border="0">
<tr>
<td align="left"><span class="Estilo5">'.$_POST["texto"].'</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0">
<tr>
<td width="26%" align="left"><span class="Estilo2">Desde la siguiente direccion ip:</span> </td>
<td width="74%" align="left">'.$REMOTE_ADDR.'</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0">
<tr>
<td width="21%" align="left" class="Estilo2">Su direccion de email es: </td>
<td width="79%" align="left">'.$_POST["email"].'</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="0">
<tr>
<td width="41%" align="left" class="Estilo2">El numero de serie asignado por el ordenador es: </td>
<td width="59%" align="left"><span class="Estilo5">'.$boundary.'</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="0">
<tr>
<td colspan="2"><table width="100%" border="0">
<tr>
<td><p>Hola '.$_POST["user"].' </p>
<p>hemos recibido el correo enviado desde www.pcmwebs.es. Si pasados 7 dias no hemos contestado su correo, notifiquenoslo al soporte tecnico [email protected] indicandonos el nombre de usuario, direccion de correo, y numero de serie asignado por el ordenador.</p>
<p>Si ha recibido el correo por error, manda un mensaje al soporte tecnico o entre en www.pcmwebs.es e indiquelo en la Web. </p>
<p>Gracias.</p></td>
</tr>
</table></td>
</tr>
<tr>
<td width="67%"> </td>
<td width="33%" align="right">Si desea visitar el sitio Web Pulse <a href="http://www.pcmwebs.es" target="_blank">Aquí</a> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>';
mail ($email, $subject, $message2, $headers);
echo "&respuesta=Ok"
?>
Bueno ya esta todo, tengo que decir que en php se llama email.php y que teoricamente esta preparado para mandar una copia a la persona que mando el correo.
Si encontrais los fallos me avisais o si sabeis hacerlo de otra forma mejor, porque hace mucho tiempo que ya no lo toco y el php me cuesta un pokito pero bueno.
