Código PHP:
<?php
$ip = $REMOTE_ADDR;
$referido = getenv("HTTP_REFERER");
//Limite, Se Refiere Al Tamaño Maximo Que Puede Tener Un Archivo, Este Numero Se Da En Bytes.
$limite = 80000;
if(!isset($HTTP_POST_VARS["email"]))
{
?>
<SCRIPT LANGUAGE="javascript">
alert("Debe Introducir El Email Al Que Desea Enviar La Informacion.\n\n");
history.go(-1);
</SCRIPT>
<?
}
else
{
$mensaje = "Email Enviado Desde La Pagina, Con El Siguiente Contenido:\n\n";
while (list($variable, $contenido) = each($HTTP_POST_VARS))
{
if($variable != "archivo")
{
$mensaje .= $variable." = ".stripslashes($contenido);
$mensaje .= "\n";
}
}
$mensaje .= "\n";
$mensaje .= "Informacion Adicional:\n\n";
$mensaje .= "Enviado Desde: ".$referido."\n";
$mensaje .= "IP: ".$ip;
$cabeceras = "From: [email][email protected][/email]";
$cabeceras .= "Reply-To: $email\n";
if($archivo != "none")
{
if($archivo_size > $limite)
{
?>
<SCRIPT LANGUAGE="javascript">
alert("Lo Siento, El Archivo Ocupa Mas De <? echo $limite; ?> bytes, El Maximo Permitido Es De <? echo $limite; ?> bytes.\n\n");
history.go(-1);
</SCRIPT>
<?
}
else
{
$file = fopen($archivo, "r");
$contenido = fread($file, $archivo_size);
$encoded_attach = chunk_split(base64_encode($contenido));
fclose($file);
$cabeceras .= "MIME-version: 1.0\n";
$cabeceras .= "Content-type: multipart/mixed; ";
$cabeceras .= "boundary=\"Message-Boundary\"\n";
$cabeceras .= "Content-transfer-encoding: 7BIT\n";
$cabeceras .= "X-attachments: $archivo_name";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=US-ASCII\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$cuerpo = $body_top.$mensaje;
$cuerpo .= "\n\n--Message-Boundary\n";
$cuerpo .= "Content-type: $archivo_type; name=\"$archivo_name\"\n";
$cuerpo .= "Content-Transfer-Encoding: BASE64\n";
$cuerpo .= "Content-disposition: attachment; filename=\"$archivo_name\"\n\n";
$cuerpo .= "$encoded_attach\n";
$cuerpo .= "--Message-Boundary--\n";
mail($email,$asunto,$cuerpo,$cabeceras);
}
}
else
{
mail($email,$asunto,$mensaje,$cabeceras);
}
?>
<SCRIPT LANGUAGE="javascript">
location.href = '<? echo $redireccion; ?>';
</SCRIPT>
<?
}
?>