Comunidad IDATUX buenas tardes.
muchas beses ne sacaron de apuros espero que esta ves también puedan ayudarme.
Quiero descargar los archivos adjuntos que hay en un correo, e probado todas las opciones que encontré en la web y nada, y por eso acudo a ustedes.
<head>
<title>Chequear cuenta de correo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="imap_css.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<h1 class="titulo"> Leer Emails </h1>
<?
// variables de conexión
$pass = '1234567';
// coneccion
$imap = @imap_open($host, $user, $pass) or die("No se puede conectar: " . imap_last_error());
// busco todos los menajes que coincidan con "asunto"
$some = imap_search($imap, 'SUBJECT "TICK-#00225"');
//el ultimo de los coinciden
$indice = 0;
for ($index = 0; $index < count($some); $index++) {
$indice = $some[$index];
}
$resultados = imap_fetch_overview($imap, $indice, 0);
?>
<table class='tabla1'>
<thead>
<tr>
<th scope="col" title="Para">Para</th>
<th scope="col" title="Mensaje">Msj</th>
<th scope="col" title="Remitente">Remitente</th>
<th scope="col" title="Asunto">Asunto</th>
<th scope="col" title="Cuerpo">Cuerpo Mensaje</th>
<th scope="col" title="Tamaño">Tamaño</th>
<th scope="col" title="Fecha">Fecha</th>
<th scope="col" title="Adjunto">Adjunto</th>
<th scope="col" title="Leido">Leido</th>
</tr>
</thead>
<?
foreach ($resultados as $detalles) {
echo "<tr>";
if ($detalles->subject == '') {
$subject = 'Sin asunto';
} else {
$subject = utf8_decode(imap_utf8($detalles->subject));
}
$from = utf8_decode(imap_utf8($detalles->from));
$msg_structure = imap_fetchstructure($imap, $detalles->msgno);
echo "<td><b>#$detalles->to</b></td>";
echo "<td><b>#$detalles->msgno</b></td>";
echo "<td><b>$from</b></td>";
echo "<td><a href='leermails2_1.php?num=$detalles->msgno'><b>$subject</b></a></td>";
$section = 1;
$mensaje = imap_fetchbody($imap, $indice, $section);
//echo base64_decode(imap_fetchbody($imap, 3, 3));
//echo nl2br(strip_tags("<td><b> $mensaje, '<p>'</b></td>"));
echo "<td><b> $mensaje, '<p>'</b></td>";
echo "<td><b>$detalles->size bytes</b></td>";
echo "<td><b>$detalles->date</b></td>";
if ($msg_structure->bytes == "") {
echo "<td><b>No</b></td>";
} else {
echo "<td><b>Sí</b></td>";
}
if ($detalles->seen == "0") {
echo "<td><b>Sin leer</b></td>";
$cont = $cont + 1;
} else {
echo "<td>Leido</td>";
}
echo "</tr>";
}
imap_close($imap);
?>
</table>
</body>
</html>