if($_POST[submited]){
$emailDestination = "direccion correo@com.uy";
$emailOrigin="direccion correo";
$nameEmailOrigin = "direccion correo";
$subject='Yo lalala";
$mensaje = "Este mensaje fue enviado por: " . $nombre . " " . $apellido . " \r\n";
$mensaje .= "Su e-mail es: " . $email . " \r\n";
$mensaje .= "Telefono: " . $_POST['telefono'] . " \r\n";
$mensaje .= "Colegio: " . $_POST['colegio'] . " \r\n";
$mensaje .= "Fecha Nacimiento: " . $_POST['fechanacimiento'] . " \r\n";
$mensaje .= "Mensaje: " . $_POST['comentario'] . " \r\n";
$mensaje .= "Enviado el " . date('d/m/Y', time());
$para1 ="$email";
$docList = 'image/gif,image/jpeg,image/jpg,image/pjpeg,image/x-png,application/msword,application/rtf,text/plain,application/octet-stream';
if (is_uploaded_file($_FILES['file1']['tmp_name']) && eregi($_FILES['file1']['type'],$docList)){
$nameFile = $_FILES['file1']['tmp_name'];
$file = fopen($nameFile, "r");
$content = fread($file, filesize($nameFile));
$encoded_attach = chunk_split(base64_encode($content));
fclose($file);
}
$headers = "From: ". $nameEmailOrigin . " <". $emailOrigin .">\n";
$headers .= "Reply-To: $emailDestination\n";
$headers .= "MIME-version: 1.0\n";
$headers .= "Content-type: multipart/mixed; ";
$headers .= "boundary=\"Message-Boundary\"\n";
$headers .= "Content-transfer-encoding: 7BIT\n";
$headers .= "X-attachments: ". $_FILES['file1']['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";
$body = $body_top.$mensaje;
if (is_uploaded_file($_FILES['file1']['tmp_name']) && eregi($_FILES['file1']['type'],$docList)){
$body .= "\n\n--Message-Boundary\n";
$body .= "Content-type: Binary; name=\"". $_FILES['file1']['name'] ."\"\n";
$body .= "Content-Transfer-Encoding: BASE64\n";
$body .= "Content-disposition: attachment; filename=\"". $_FILES['file1']['name'] ."\"\n\n";
$body .= "$encoded_attach\n";
$body .= "--Message-Boundary--\n";
}
if(mail($emailDestination,$subject,$body,$headers)){
include ('gracias.htm');
}
}
else{
}
}
?>