Prueba a cambiar tu código por este y después lee más abajo:
Código HTML:
<!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=utf-8" />
<title>titulo</title>
<script type="text/javascript">
function mostrar_popup()
{
if(document.form1.Nombre.value!=0 && document.form1.EMAIL.value!=0)
{
var pagina = "popup_mail.php?nombre="+document.form1.Nombre.value+"&email="+document.form1.EMAIL.value;
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=700, height=350, top=125,left=350";
window.open(pagina,"",opciones);
}
}
</script>
</head>
<?php
$Nombre=$_POST['Nombre'];
$EMAIL=$_POST['EMAIL'];
if ($Nombre!= "" && $EMAIL!= "")
{
mysql_connect("localhost","root","1234");
mysql_select_db("base");
mysql_query("INSERT INTO tabla(Nombre,EMAIL)
VALUES('$Nombre','$EMAIL')");
}
?>
<?
$destinatario = $EMAIL;
$asunto = "mensaje de prueba";
$cuerpo = '
<html>
<head>
<title>Prueba de correo</title>
</head>
mensaje de prueba en formato html
</body>
</html>
';
//para el envío en formato HTML
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
//dirección del remitente
$headers .= "From: yo <[email protected]>\r\n";
//dirección de respuesta, si queremos que sea distinta que la del remitente
$headers .= "Reply-To: [email protected]\r\n";
//direcciones que recibián copia
$headers .= "Cc: [email protected]\r\n";
mail($destinatario,$asunto,$cuerpo,$headers)
?>
<body>
<form id="form1" name="form1" method="post" action="">
<p><img src="logo.png" width="232" height="49" /></p>
<p>registro - Llenar todos los campos de lo contrario los datos no se enviaran correctamente</p>
<table width="663" border="1">
<tr>
<td width="303">Nombre</td>
<td width="348"><input name="Nombre" type="text" id="Nombre" size="58" /></td>
</tr>
<tr>
<td>E-MAIL</td>
<td><label for="EMAIL"></label>
<input name="EMAIL" type="text" id="EMAIL" size="58" /></td>
</tr>
<tr>
<td colspan="2"><p>
<input type="submit" onclick="mostrar_popup()" name="button" id="button" value="Enviar datos del nuevo cliente" />
</p></td>
</tr>
</table>
<label for="Nombre"></label>
</form>
<p> </p>
</body>
</html>
Ahora necesitarás crear otro archivo con el siguiente nombre:popup_mail.php y a ese archivo introdúcele únicamente el siguiente código: Código HTML:
<?php
$Nombre = $_GET['nombre'];
$EMAIL = $_GET['email'];
$cuerpo = "Aquí introduces el texto que se envía en los emails.";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-mail enviado</title>
</head>
<body>
<?php
echo "
<b>Nombre:</b> $Nombre
<br />
<b>Email:</b> $EMAIL
<br />
<br />
$cuerpo
";
?>
</body>
</html>
Prueba si te funciona ahora y me dices. Puedes cambiar los códigos a tu gusto. Un saludo!