Código PHP:
<?php
$asunto = $_POST['asunto'].".txt";
if ( isset( $_POST ) )
$postArray = &$_POST ; // 4.1.0 or later, use $_POST
else
$postArray = &$HTTP_POST_VARS ; // prior to 4.1.0, use HTTP_POST_VARS
foreach ( $postArray as $sForm => $value )
{
if ( get_magic_quotes_gpc() )
$postedValue = htmlspecialchars( stripslashes( $value ) ) ;
else
$postedValue = htmlspecialchars( $value ) ;
}
// creo el archivo, con el nombre del asunto del correo, y el contenido sera lo que // contenga la variable $postedValue
$nombre=$asunto;
$archivo = fopen($nombre, "a");
$contenido=$postedValue;
if ($archivo) {
fputs ($archivo, $contenido);
}
fclose ($archivo);
if($archivo){
?> <script language="JavaScript">
alert("Mensaje guardado en borradores");
location.href = "enviar_mails.php";
</SCRIPT>
<?php
}
?>