PHP - correo en php

 
Vista:

correo en php

Publicado por daniel  (2 intervenciones) el 06/07/2010 17:53:21
hola buenas tardes tengo un programita que me lee mis correo s gmail pero no puedo bajarme los archivos adjuntos y no tengo ni idea por donde cojerlo

os dejo el cojigo:

<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"> Webmail </h1>

<?
$imap = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "[email protected]", "********") or die("No Se Pudo Conectar Al Servidor:" . imap_last_error());
$checar = imap_check($imap);

// Detalles generales de todos los mensajes del usuario.
$resultados = imap_fetch_overview($imap,"1:{$checar->Nmsgs}",0);
$messages = imap_sort($imap, SORTARRIVAL, 1);

echo "<pre>";
foreach ($messages as $message) {
$header = imap_header($imap, $message);
$prettydate = date("jS F Y", $header->udate);
print "{$header->fromaddress} - $prettydate\n";
}
echo "</pre>";

$cont = 0;

// Informacion del mailbox
$check = imap_mailboxmsginfo($imap);

echo "<div class='estadisticas'>";
if ($check) {
echo "Fecha: " . $check->Date . "<br/>" ;
//echo "Driver: " . $check->Driver . "<br />\n" ;
//echo "Mailbox: " . $check->Mailbox . "<br />\n" ;
echo "Total Mensajes: $check->Nmsgs | Sin Leer: $check->Unread | Recientes: $check->Recent | Eliminados: $check->Deleted <br/>";
echo "Tamaño buzón: " . $check->Size . "<br/><br/>" ;
} else {
echo "imap_check() failed: " . imap_last_error() . "<br />\n";
}
echo "</div>";

// MOSTRAMOS EL MENSAJE
echo "-------------------------------------------------------<br />";
if (isset($_GET['num'])){
$num_mensaje=$_GET['num'];
echo "Mostrando cuerpo del mensaje #$num_mensaje<br/>";
$cont=0;
foreach ($resultados as $detalles) {
$cont = $cont + 1;
if ($cont == $num_mensaje){
$asunto=$detalles->subject;
echo "<p class='asunto'>$asunto</p>";}
}

$section = 1;
$mensaje = imap_fetchbody($imap, $num_mensaje, $section);
echo nl2br(strip_tags($mensaje,'<p>')); // Util para los mensajes HTML, los transforma en texto plano

}else{
echo "Mensaje no encontrado<br/>";
}
echo "<br />-------------------------------------------------------<br />";

?>
<table class='tabla1'>
<thead>
<tr>
<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="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>
<?
//$i=0;
foreach ($resultados as $detalles) {
echo "<tr>";
//echo "Para: $detalles->to <br>";

// Ponemos 'Sin asunto' en caso que no tenga.
if ($detalles->subject == ''){$subject='Sin asunto';}
else{
//Evita asuntos tipo =?ISO-8859-1?Q?B=F8lla?=
$subject = utf8_decode(imap_utf8($detalles->subject));
}
$from = utf8_decode(imap_utf8($detalles->from));

// Mirar si tiene adjuntos
$msg_structure = imap_fetchstructure($imap, $detalles->msgno);

echo "<td><b>#$detalles->msgno</b></td>";
echo "<td><b>$from</b></td>";
echo "<td><a href='3.php?num=$detalles->msgno'><b>$subject</b></a></td>";
//echo "<td><a href='mostrar_correo.php?msj=$detalles->msgno'><b>$subject</b></a></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>";
}

//$servidorenvia = strstr($detalles->message_id, '@');
//echo "Dominio Que Envia: $servidorenvia<br><hr>";
echo "</tr>";
}
echo "</table>";

imap_close($imap);
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:correo en php

Publicado por Carles (17 intervenciones) el 08/07/2010 11:34:10
¿Qué clase usas?

Es por hecharle un vistazo a la documentación y ver que pasa.

Un saludo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:correo en php

Publicado por daniel  (2 intervenciones) el 12/07/2010 08:54:13
la clase que uso es la de phpmail

llevo todo el finde mirando como y sin resultados posotivos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar